@@ -25,11 +25,13 @@ function(aws_prebuild_dependency)
25
25
set (depInstallDir ${depBinaryDir} /install )
26
26
file (MAKE_DIRECTORY ${depBinaryDir} )
27
27
28
+ # Convert prefix path from list to escaped string, to be passed on command line
29
+ string (REPLACE ";" "\\\\ ;" ESCAPED_PREFIX_PATH "${CMAKE_PREFIX_PATH} " )
28
30
# For execute_process to accept a dynamically constructed command, it should be passed in a list format.
29
- set (cmakeCommand "COMMAND" " ${CMAKE_COMMAND} " )
31
+ set (cmakeCommand "${CMAKE_COMMAND} " )
30
32
list (APPEND cmakeCommand -S ${AWS_PREBUILD_SOURCE_DIR} )
31
33
list (APPEND cmakeCommand -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} )
32
- list (APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH } )
34
+ list (APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${ESCAPED_PREFIX_PATH } )
33
35
list (APPEND cmakeCommand -DCMAKE_INSTALL_PREFIX=${depInstallDir} )
34
36
list (APPEND cmakeCommand -DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH} )
35
37
list (APPEND cmakeCommand -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} )
@@ -39,11 +41,13 @@ function(aws_prebuild_dependency)
39
41
list (APPEND cmakeCommand ${AWS_PREBUILD_CMAKE_ARGUMENTS} )
40
42
endif ()
41
43
42
- list (APPEND cmakeCommand WORKING_DIRECTORY ${depBinaryDir} )
43
- list (APPEND cmakeCommand RESULT_VARIABLE result)
44
-
45
44
# Configure dependency project.
46
- execute_process (${cmakeCommand} )
45
+ execute_process (
46
+ COMMAND ${cmakeCommand}
47
+ WORKING_DIRECTORY ${depBinaryDir}
48
+ RESULT_VARIABLE result
49
+ )
50
+
47
51
if (NOT ${result} EQUAL 0)
48
52
message (FATAL_ERROR "Configuration failed for dependency project ${AWS_PREBUILD_DEPENDENCY_NAME} " )
49
53
endif ()
0 commit comments