-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
If I have a simple CMake project
cmake_minimum_required(VERSION 3.18)
project(example_project LANGUAGES CXX)
add_executable(main main.cpp)it defaults to putting the executables in the build directory.
% cd build && make
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable mainWhen I tried adding RAJA as a dependency with FetchContent
cmake_minimum_required(VERSION 3.18)
project(example_project LANGUAGES CXX)
include(FetchContent)
FetchContent_Declare(
raja
URL https://github.com/LLNL/RAJA/releases/download/v2024.07.0/RAJA-v2024.07.0.tar.gz
)
set(RAJA_ENABLE_TESTS OFF CACHE INTERNAL "")
set(RAJA_ENABLE_EXAMPLES OFF CACHE INTERNAL "")
set(RAJA_ENABLE_EXERCISES OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(raja)
add_executable(main main.cpp)RAJA built just fine, but I couldn't find my executables any more. When I looked more closely, I saw that they were being put in RAJA's output directory, which surprised me.
% cd build && make
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable _deps/raja-build/bin/mainI haven't looked into it too closely, but it seems like the cause is not RAJA after all, but BLT unconditionally setting the value of CMAKE_RUNTIME_OUTPUT_DIRECTORY here
Lines 158 to 162 in 5468efd
| # Set the path where all the installed executables will go | |
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY | |
| ${PROJECT_BINARY_DIR}/bin | |
| CACHE PATH | |
| "Directory where executables will go in the build tree") |
As a user, my expectation is that bringing in a child project through FetchContent shouldn't result in changing the global settings of the parent project.
Metadata
Metadata
Assignees
Labels
No labels