Skip to content

Commit f8c5d8e

Browse files
TingDaoKgraebm
andauthored
[fix] prebuild set CMAKE_PREFIX_PATH properly (#1154)
Co-authored-by: Michael Graeb <[email protected]>
1 parent 6978946 commit f8c5d8e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cmake/AwsPrebuildDependency.cmake

+10-6
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ function(aws_prebuild_dependency)
2525
set(depInstallDir ${depBinaryDir}/install)
2626
file(MAKE_DIRECTORY ${depBinaryDir})
2727

28+
# Convert prefix path from list to escaped string, to be passed on command line
29+
string(REPLACE ";" "\\\\;" ESCAPED_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
2830
# 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}")
3032
list(APPEND cmakeCommand -S ${AWS_PREBUILD_SOURCE_DIR})
3133
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})
3335
list(APPEND cmakeCommand -DCMAKE_INSTALL_PREFIX=${depInstallDir})
3436
list(APPEND cmakeCommand -DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH})
3537
list(APPEND cmakeCommand -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
@@ -39,11 +41,13 @@ function(aws_prebuild_dependency)
3941
list(APPEND cmakeCommand ${AWS_PREBUILD_CMAKE_ARGUMENTS})
4042
endif()
4143

42-
list(APPEND cmakeCommand WORKING_DIRECTORY ${depBinaryDir})
43-
list(APPEND cmakeCommand RESULT_VARIABLE result)
44-
4544
# Configure dependency project.
46-
execute_process(${cmakeCommand})
45+
execute_process(
46+
COMMAND ${cmakeCommand}
47+
WORKING_DIRECTORY ${depBinaryDir}
48+
RESULT_VARIABLE result
49+
)
50+
4751
if (NOT ${result} EQUAL 0)
4852
message(FATAL_ERROR "Configuration failed for dependency project ${AWS_PREBUILD_DEPENDENCY_NAME}")
4953
endif()

0 commit comments

Comments
 (0)