[CMake] CMAKE_RUNTIME_OUTPUT_DIRECTORY inconsistent between make and Xcode
Lucas Soltic
lucas.soltic at orange.fr
Wed Mar 5 17:38:07 EST 2014
Hello,
I have noticed an annoying difference between Xcode and make as far as the output directory is concerned.
I have added the following to my CMakeLists.txt:
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
When I run the makefiles generated by CMake with CMAKE_BUILD_TYPE=Debug, I can find all of my executables and libraries in build_dir/bin.
However, if I generate an Xcode project with CMake and build my binaries, they'll end up partly in build_dir/bin and partly in build_dir/bin/Debug.
With Xcode, the binaries that end up in build_dir/bin/Debug are those generated by add_executable/library CMake rules. And the binaries that end up in build_dir/bin are those generated by my add_custom_command to which I told to put the binaries in ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}.
But if I tell my custom command to put the binaries in ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}, then it'll be ok with Xcode but not make. So what should I do?
Is it an expected behavior?
Thanks,
Lucas
More information about the CMake
mailing list