Skip to content

Commit fadfef4

Browse files
authored
Support relative paths when prebuilding dependencies with CMake (#1174)
**Issue:** When aws-crt-java started prebuilding AWS-LC, the release pipeline broke due to a relative path being passed to CMake (see: awslabs/aws-crt-java#851) Since the AwsPrebuildDependency changed the working directory while running CMake, the relative path became invalid. **Description of changes:** Instead of changing the working directory while running CMake, use the `-B<path-to-build>` option (which exists prior to CMake 3.13 even though it's not documented, note that it's a bit weird pre-3.13 with no space after the B))
1 parent 0226008 commit fadfef4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmake/AwsPrebuildDependency.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function(aws_prebuild_dependency)
3636
list(APPEND cmakeCommand ${cmakeOptionalVariables})
3737

3838
# The following variables should always be used.
39+
list(APPEND cmakeCommand -B${depBinaryDir})
3940
list(APPEND cmakeCommand ${AWS_PREBUILD_SOURCE_DIR})
4041
list(APPEND cmakeCommand -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
4142
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${ESCAPED_PREFIX_PATH})
@@ -57,7 +58,6 @@ function(aws_prebuild_dependency)
5758
# Configure dependency project.
5859
execute_process(
5960
COMMAND ${cmakeCommand}
60-
WORKING_DIRECTORY ${depBinaryDir}
6161
RESULT_VARIABLE result
6262
)
6363

@@ -67,8 +67,7 @@ function(aws_prebuild_dependency)
6767

6868
# Build and install dependency project into depInstallDir directory.
6969
execute_process(
70-
COMMAND ${CMAKE_COMMAND} --build . --target install
71-
WORKING_DIRECTORY ${depBinaryDir}
70+
COMMAND ${CMAKE_COMMAND} --build ${depBinaryDir} --target install
7271
RESULT_VARIABLE result
7372
)
7473
if (NOT ${result} EQUAL 0)

0 commit comments

Comments
 (0)