Skip to content

Commit

Permalink
Support relative paths when prebuilding dependencies with CMake, by N…
Browse files Browse the repository at this point in the history
…OT changing the working directory. Instead use the -B<path-to-build> option, which exists prior to CMake 3.13 even though it's not documented (note: it's a bit weird pre-3.13, with no space after the B)
  • Loading branch information
graebm committed Dec 3, 2024
1 parent 0226008 commit 748b5e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmake/AwsPrebuildDependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function(aws_prebuild_dependency)
list(APPEND cmakeCommand ${cmakeOptionalVariables})

# The following variables should always be used.
list(APPEND cmakeCommand -B${depBinaryDir})
list(APPEND cmakeCommand ${AWS_PREBUILD_SOURCE_DIR})
list(APPEND cmakeCommand -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${ESCAPED_PREFIX_PATH})
Expand All @@ -57,7 +58,6 @@ function(aws_prebuild_dependency)
# Configure dependency project.
execute_process(
COMMAND ${cmakeCommand}
WORKING_DIRECTORY ${depBinaryDir}
RESULT_VARIABLE result
)

Expand All @@ -67,8 +67,7 @@ function(aws_prebuild_dependency)

# Build and install dependency project into depInstallDir directory.
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --target install
WORKING_DIRECTORY ${depBinaryDir}
COMMAND ${CMAKE_COMMAND} --build ${depBinaryDir} --target install
RESULT_VARIABLE result
)
if (NOT ${result} EQUAL 0)
Expand Down

0 comments on commit 748b5e1

Please sign in to comment.