[CMake] Binaries not ending up in the RUNTIME_OUTPUT_DIRECTORY
Michael Wild
themiwi at gmail.com
Mon May 17 11:29:38 EDT 2010
Naaa, the variables are simply called CMAKE_RUNTIME_OUTPUT_DIRECTORY, CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_ARCHIVE_OUTPUT_DIRECTORY. Aaron mixed them up with the respective target property names
A few other things:
- you can call INCLUDE_DIRECTORIES with more than one directory
- NEVER use FILE(GLOB ...), it is evil.
Michael
On 17. May, 2010, at 17:21 , Tyler Roscoe wrote:
> You probably need the Prefix Hack:
> http://www.itk.org/Bug/view.php?id=8243
>
> tyler
>
> On Mon, May 17, 2010 at 09:53:34AM -0500, aaron.meadows at thomsonreuters.com wrote:
>> Hi All!
>>
>>
>>
>> I'm trying to migrate an existing Visual Studio 8 2005 source tree to
>> CMake. The only problem I'm having right now is getting the build
>> artifacts to end up in the directories I want them in. I would like
>> everything to show up in the ${PROJECT_BINARY_DIR}/bin dir, but only
>> static libraries are showing up there. In particular, I have noticed
>> this as I've been adding post build steps to call my unit tests. I'll
>> include my root CMakeLists.txt and the UnitTest CMakeLists.txt. If
>> anyone can spot the issue, I'd be grateful! (Any other suggestions
>> welcome as well!)
>>
>>
>>
>> ( Note, the MESSAGE() calls show that the two variables are defined
>> correctly in both CMakeLists.txt files. )
>>
>>
>>
>> Root CMakeLists.txt (./CmakeLists.txt)
>>
>> cmake_minimum_required (VERSION 2.6)
>>
>>
>>
>> set(CMAKE_USER_MAKE_RULES_OVERRIDE
>>
>> ${CMAKE_CURRENT_SOURCE_DIR}/c_flag_overrides.cmake)
>>
>> set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
>>
>> ${CMAKE_CURRENT_SOURCE_DIR}/cxx_flag_overrides.cmake)
>>
>>
>>
>> project (VersionInfo CXX)
>>
>>
>>
>> # Default Include Dir
>>
>> include_directories("${PROJECT_SOURCE_DIR}")
>>
>> include_directories("$ENV{RDFD3RDPARTYDIR}/include")
>>
>>
>>
>> link_directories("$ENV{RDFD3RDPARTYDIR}/lib")
>>
>> if(DEBUG)
>>
>> link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Debug")
>>
>> else()
>>
>> link_directories("$ENV{RDFD3RDPARTYDIR}/lib/Release")
>>
>> endif()
>>
>>
>>
>> # New style of output location... doesn't seem to be supported in my
>> version of CMake
>>
>> SET( RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
>>
>> SET( LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
>>
>> SET( ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
>>
>>
>>
>> # Old style of output location... still works
>>
>> SET( RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
>>
>> SET( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
>>
>> SET( ARCHIVE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
>>
>> LINK_DIRECTORIES( ${LIBRARY_OUTPUT_DIRECTORY})
>>
>>
>>
>> ENABLE_TESTING()
>>
>>
>>
>> MESSAGE("Master: Runtime_output_path: ${RUNTIME_OUTPUT_PATH} ")
>>
>> MESSAGE("Master: Runtime_output_directory: ${RUNTIME_OUTPUT_DIRECTORY}
>> ")
>>
>>
>>
>> add_definitions(-D_SCL_SECURE_NO_WARNINGS)
>>
>>
>>
>> # Library projects
>>
>> add_subdirectory(Toolbox)
>>
>> add_subdirectory(VersionSystem)
>>
>>
>>
>> # Executables
>>
>> add_subdirectory(VersionCompiler)
>>
>> add_subdirectory(ReadVer)
>>
>>
>>
>> # Test Projects
>>
>> add_subdirectory(TestLib1)
>>
>> add_subdirectory(TestLib2)
>>
>> add_subdirectory(TestDLL)
>>
>> add_subdirectory(TestEXE)
>>
>>
>>
>>
>>
>> UnitTest CMakeLists.txt (./VersionSystem/UnitTests/CMakeLists.txt)
>>
>> FILE( GLOB interfacefiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.hpp
>> )
>>
>> FILE( GLOB srcfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.hpp *.cpp
>> *.c )
>>
>>
>>
>> SOURCE_GROUP( Interface FILES ${interfacefiles} )
>>
>> SOURCE_GROUP( Source FILES ${srcfiles} )
>>
>>
>>
>> ADD_EXECUTABLE( VersionSystem-UT ${srcfiles} )
>>
>> TARGET_LINK_LIBRARIES( VersionSystem-UT VersionSystem )
>>
>>
>>
>> MESSAGE("VersionSystem-UT: Runtime_output_path: ${RUNTIME_OUTPUT_PATH}
>> ")
>>
>> MESSAGE("VersionSystem-UT: Runtime_output_directory:
>> ${RUNTIME_OUTPUT_DIRECTORY} ")
>>
>>
>>
>> ADD_CUSTOM_COMMAND(TARGET VersionSystem-UT POST_BUILD COMMAND
>> VersionSystem-UT.exe WORKING_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY} )
>>
>> #ADD_TEST( VersionSystem VersionSystem-UT )
>>
>>
>>
>> Directory Structure and CMakeLists.txt locations:
>>
>> ./CMakeLists.txt
>>
>> ./ReadVer/CMakeLists.txt
>>
>> ./ReadVer/UnitTests/CMakeLists.txt
>>
>> ./TestDLL/CMakeLists.txt
>>
>> ./TestDLL/UnitTests/CMakeLists.txt
>>
>> ./TestEXE/CMakeLists.txt
>>
>> ./TestEXE/UnitTests/CMakeLists.txt
>>
>> ./TestLib1/CMakeLists.txt
>>
>> ./TestLib1/UnitTests/CMakeLists.txt
>>
>> ./TestLib2/CMakeLists.txt
>>
>> ./TestLib2/UnitTests/CMakeLists.txt
>>
>> ./Toolbox/CMakeLists.txt
>>
>> ./Toolbox/UnitTests/CMakeLists.txt
>>
>> ./VersionCompiler/CMakeLists.txt
>>
>> ./VersionCompiler/UnitTests/CMakeLists.txt
>>
>> ./VersionSystem/CMakeLists.txt
>>
>> ./VersionSystem/UnitTests/CMakeLists.txt
>>
>>
>>
>> Aaron Meadows
>> Software Engineer
>>
>> Thomson Reuters
>>
>> Phone: 314.468.3530
>> Mobile: 636.541.6139
>> aaron.meadows at thomsonreuters.com
>> thomsonreuters.com
More information about the CMake
mailing list