Fix configure_file output path by adding CMAKE_BINARY_DIR #437
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I am trying to build the aws-iot-device-client with BUILD_SDK=OFF and where the CMake build directory is not placed directly under the aws-iot-device-client. The build failed, reporting (for the googletest case):
The motivation for having the build directory in a non-standard location is to build aws-iot-device-client against a seperate checkout of the SDK along with other software that uses the SDK as part of a larger cross-compile build.
Modifications
Change summary
The solution is to add ${CMAKE_BINARY_DIR} to the output argument of the configure_file CMake function. With this, the CMakeLists.txt.gtest or CMakeLists.txt.awssdk file will correctly be copied to the build/binary directory and the build completes successfully.
Testing
Failure case:
Example top level CMakeLists.txt which is part of larger build:
Test steps:
This is fixed with this pull request.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.