From 748b5e1c64e50ac5a0ba3b355f2b6bacd86501cc Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 3 Dec 2024 10:14:49 -0800 Subject: [PATCH] Support relative paths when prebuilding dependencies with CMake, by NOT changing the working directory. Instead use the -B 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) --- cmake/AwsPrebuildDependency.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/AwsPrebuildDependency.cmake b/cmake/AwsPrebuildDependency.cmake index 2637f9594..e9bdbb6f3 100644 --- a/cmake/AwsPrebuildDependency.cmake +++ b/cmake/AwsPrebuildDependency.cmake @@ -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}) @@ -57,7 +58,6 @@ function(aws_prebuild_dependency) # Configure dependency project. execute_process( COMMAND ${cmakeCommand} - WORKING_DIRECTORY ${depBinaryDir} RESULT_VARIABLE result ) @@ -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)