[CMake] Binaries not ending up in the RUNTIME_OUTPUT_DIRECTORY
Tyler Roscoe
tyler at cryptio.net
Mon May 17 11:21:39 EDT 2010
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
>
>
>
>
>
> This email was sent to you by Thomson Reuters, the global news and information company.
> Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thomson Reuters.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list