summaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorJosh Morman <jmorman@perspectalabs.com>2019-07-18 09:17:38 -0400
committerMarcus Müller <marcus@hostalia.de>2019-07-19 23:43:06 +0200
commit6984088ea6e67e848803c947cf83ffaaa4f8e6c1 (patch)
treea455c9a0b84738ebb614e0c463305a00093047f3 /cmake/Modules
parente97c79abff60d752574fbb1b8caae5b9a35b3fc1 (diff)
modtool: put proper quotes when unescaped shell paths
Adds quotes to paths to prevent issues when the user has a space in their OOT shell paths Slight change to #2560 which should prevent CI from broadly failing Fixes #2443
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/GrTest.cmake16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake
index 5de7476f3f..2cd7d51fde 100644
--- a/cmake/Modules/GrTest.cmake
+++ b/cmake/Modules/GrTest.cmake
@@ -22,6 +22,13 @@ if(DEFINED __INCLUDED_GR_TEST_CMAKE)
endif()
set(__INCLUDED_GR_TEST_CMAKE TRUE)
+function (GR_CONVERT_QUOTED_STRING path_str quoted_path)
+ file(TO_NATIVE_PATH "${path_str}" path_str)
+ string(CONCAT path_str "\"" ${path_str} "\"")
+ string(REPLACE "\\ " " " path_str ${path_str})
+ set(${quoted_path} "${path_str}" PARENT_SCOPE)
+endfunction()
+
########################################################################
# Add a unit test and setup the environment for a unit test.
# Takes the same arguments as the ADD_TEST function.
@@ -59,8 +66,11 @@ function(GR_ADD_TEST test_name)
endforeach(pydir)
endif(WIN32)
- file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
- file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ GR_CONVERT_QUOTED_STRING("${CMAKE_CURRENT_BINARY_DIR}" bindir)
+ GR_CONVERT_QUOTED_STRING("${CMAKE_CURRENT_SOURCE_DIR}" srcdir)
+ GR_CONVERT_QUOTED_STRING("${GR_TEST_LIBRARY_DIRS}" libpath)
+ #GR_CONVERT_QUOTED_STRING("${GR_TEST_PYTHON_DIRS}" pypath)
+ # Keep the original path conversion for pypath - the above commented line breaks CI tests
file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
set(environs "VOLK_GENERIC=1" "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}"
@@ -79,7 +89,7 @@ function(GR_ADD_TEST test_name)
set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
endif()
- set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ set(binpath "${bindir}:$PATH")
list(APPEND libpath "$${LD_PATH_VAR}")
list(APPEND pypath "$PYTHONPATH")