[Bf-blender-cvs] [43a24940588] master: CMake: add path_ensure_trailing_slash utility macro
Campbell Barton
noreply at git.blender.org
Wed Nov 4 06:02:00 CET 2020
Commit: 43a2494058885d504d86a0b309281a6b1b1d4a65
Author: Campbell Barton
Date: Wed Nov 4 15:59:55 2020 +1100
Branches: master
https://developer.blender.org/rB43a2494058885d504d86a0b309281a6b1b1d4a65
CMake: add path_ensure_trailing_slash utility macro
===================================================================
M build_files/cmake/macros.cmake
===================================================================
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 8498c68c21c..ea348b06a07 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -60,6 +60,19 @@ function(list_assert_duplicates
unset(_len_after)
endfunction()
+# Adds a native path separator to the end of the path:
+#
+# - 'example' -> 'example/'
+# - '/example///' -> '/example/'
+#
+macro(path_ensure_trailing_slash
+ path_new path_input
+ )
+ file(TO_NATIVE_PATH "/" _path_sep)
+ string(REGEX REPLACE "[${_path_sep}]+$" "" ${path_new} ${path_input})
+ set(${path_new} "${${path_new}}${_path_sep}")
+ unset(_path_sep)
+endmacro()
# foo_bar.spam --> foo_barMySuffix.spam
macro(file_suffix
More information about the Bf-blender-cvs
mailing list