Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-04 07:59:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-04 07:59:55 +0300
commit43a2494058885d504d86a0b309281a6b1b1d4a65 (patch)
treec59c5c01816934712691814ad27909e44ecc6586 /build_files/cmake/macros.cmake
parent2f7ec507f4ed8f8b0d9535836a8260895d2c3f03 (diff)
CMake: add path_ensure_trailing_slash utility macro
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r--build_files/cmake/macros.cmake13
1 files changed, 13 insertions, 0 deletions
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