Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] prebuild set CMAKE_PREFIX_PATH properly #1154

Merged
merged 7 commits into from
Oct 11, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions cmake/AwsPrebuildDependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ function(aws_prebuild_dependency)
set(depInstallDir ${depBinaryDir}/install)
file(MAKE_DIRECTORY ${depBinaryDir})

# Conver the prefix path from list to escaped string to be passed as value used by
# `-DCMAKE_PREFIX_PATH` for the subprecoess
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
string(REPLACE ";" "\\\\;" ESCAPDED_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
# For execute_process to accept a dynamically constructed command, it should be passed in a list format.
set(cmakeCommand "COMMAND" "${CMAKE_COMMAND}")
set(cmakeCommand "${CMAKE_COMMAND}")
list(APPEND cmakeCommand -S ${AWS_PREBUILD_SOURCE_DIR})
list(APPEND cmakeCommand -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH})
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${ESCAPDED_PREFIX_PATH})
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
list(APPEND cmakeCommand -DCMAKE_INSTALL_PREFIX=${depInstallDir})
list(APPEND cmakeCommand -DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH})
list(APPEND cmakeCommand -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
Expand All @@ -39,11 +42,13 @@ function(aws_prebuild_dependency)
list(APPEND cmakeCommand ${AWS_PREBUILD_CMAKE_ARGUMENTS})
endif()

list(APPEND cmakeCommand WORKING_DIRECTORY ${depBinaryDir})
list(APPEND cmakeCommand RESULT_VARIABLE result)

# Configure dependency project.
execute_process(${cmakeCommand})
execute_process(
COMMAND ${cmakeCommand}
WORKING_DIRECTORY ${depBinaryDir}
RESULT_VARIABLE result
)

if (NOT ${result} EQUAL 0)
message(FATAL_ERROR "Configuration failed for dependency project ${AWS_PREBUILD_DEPENDENCY_NAME}")
endif()
Expand Down
Loading