This PR sets the target output locations to the bin
and lib
subdirectories within the build tree, creating a directory structure that mirrors that of the installed targets.
This approach is widely adopted by the large projects, such as LLVM:
0set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
2set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
The libsecp256k1
project has also recently adopted this approach.
With this PR, all binaries are conveniently located. For example, run:
0$ ./build/bin/fuzz
instead of:
0$ ./build/src/test/fuzz/fuzz
On Windows, all required DLLs are now located in the same directory as the executables, allowing to run bitcoin-chainstate.exe
(which loads bitcoinkernel.dll
) without the need to copy DLLs or modify the PATH
variable.
The idea was briefly discussed among the build team during the recent CoreDev meeting.