[CMake] Binaries not ending up in the RUNTIME_OUTPUT_DIRECTORY
aaron.meadows at thomsonreuters.com
aaron.meadows at thomsonreuters.com
Mon May 17 10:53:34 EDT 2010
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100517/c4a8708f/attachment-0001.htm>
More information about the CMake
mailing list