|
Boost-Commit : |
From: troy_at_[hidden]
Date: 2008-05-20 13:37:49
Author: troy
Date: 2008-05-20 13:37:48 EDT (Tue, 20 May 2008)
New Revision: 45586
URL: http://svn.boost.org/trac/boost/changeset/45586
Log:
As of cmake 2.6.0 targets must have globally unique names, or you get errors like this:
CMake Error: Attempt to add link library "boost_unit_test_framework-static"
to target "test3" which is not built by this project.
CMake Error at tools/build/CMake/BoostCore.cmake:1080 (add_executable):
add_executable cannot create target "test4" because another target with the
same name already exists. The existing target is an executable created in
source directory
"/home/troy/Projects/boost/branches/CMake/Boost_1_35_0/libs/variant/test".
See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
tools/build/CMake/BoostTesting.cmake:173 (boost_add_executable)
libs/xpressive/test/CMakeLists.txt:50 (boost_test_run)
This creates logical target names of Projectname/targetname
for executables (which includes tests).
Text files modified:
branches/CMake/Boost_1_35_0/tools/build/CMake/BoostCore.cmake | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
Modified: branches/CMake/Boost_1_35_0/tools/build/CMake/BoostCore.cmake
==============================================================================
--- branches/CMake/Boost_1_35_0/tools/build/CMake/BoostCore.cmake (original)
+++ branches/CMake/Boost_1_35_0/tools/build/CMake/BoostCore.cmake 2008-05-20 13:37:48 EDT (Tue, 20 May 2008)
@@ -1077,10 +1077,11 @@
endforeach(LIB ${THIS_EXE_DEPENDS})
# Build the executable
- add_executable(${EXENAME} ${THIS_EXE_SOURCES})
+ set(THIS_EXE_NAME ${PROJECT_NAME}/${EXENAME})
+ add_executable(${THIS_EXE_NAME} ${THIS_EXE_SOURCES})
# Set the various compilation and linking flags
- set_target_properties(${EXENAME}
+ set_target_properties(${THIS_EXE_NAME}
PROPERTIES
COMPILE_FLAGS "${THIS_EXE_COMPILE_FLAGS}"
LINK_FLAGS "${THIS_EXE_LINK_FLAGS}"
@@ -1089,7 +1090,7 @@
# For IDE generators where we can build both debug and release
# configurations, pass the configurations along separately.
if (THIS_EXE_DEBUG_AND_RELEASE)
- set_target_properties(${EXENAME}
+ set_target_properties(${THIS_EXE_NAME}
PROPERTIES
COMPILE_FLAGS_DEBUG "${DEBUG_COMPILE_FLAGS} ${THIS_EXE_COMPILE_FLAGS}"
COMPILE_FLAGS_RELEASE "${RELEASE_COMPILE_FLAGS} ${THIS_EXE_COMPILE_FLAGS}"
@@ -1100,7 +1101,7 @@
# If the user gave an output name, use it.
if (THIS_EXE_OUTPUT_NAME)
- set_target_properties(${EXENAME}
+ set_target_properties(${THIS_EXE_NAME}
PROPERTIES
OUTPUT_NAME "${THIS_EXE_OUTPUT_NAME}"
)
@@ -1109,26 +1110,26 @@
# Link against the various libraries
if (THIS_EXE_DEBUG_AND_RELEASE)
# Configuration-agnostic libraries
- target_link_libraries(${EXENAME} ${THIS_EXE_LINK_LIBS})
+ target_link_libraries(${THIS_EXE_NAME} ${THIS_EXE_LINK_LIBS})
# Link against libraries for "release" configuration
foreach(LIB ${THIS_EXE_RELEASE_ACTUAL_DEPENDS} ${THIS_EXE_RELEASE_LINK_LIBS})
- target_link_libraries(${EXENAME} optimized ${LIB})
+ target_link_libraries(${THIS_EXE_NAME} optimized ${LIB})
endforeach(LIB ${THIS_EXE_RELEASE_ACTUAL_DEPENDS} ${THIS_EXE_RELEASE_LINK_LIBS})
# Link against libraries for "debug" configuration
foreach(LIB ${THIS_EXE_DEBUG_ACTUAL_DEPENDS} ${THIS_EXE_DEBUG_LINK_LIBS})
- target_link_libraries(${EXENAME} debug ${LIB})
+ target_link_libraries(${THIS_EXE_NAME} debug ${LIB})
endforeach(LIB ${THIS_EXE_DEBUG_ACTUAL_DEPENDS} ${THIS_EXE_DEBUG_LINK_LIBS})
else (THIS_EXE_DEBUG_AND_RELEASE)
- target_link_libraries(${EXENAME}
+ target_link_libraries(${THIS_EXE_NAME}
${THIS_EXE_ACTUAL_DEPENDS}
${THIS_EXE_LINK_LIBS})
endif (THIS_EXE_DEBUG_AND_RELEASE)
# Install the executable, if not suppressed
if (NOT THIS_EXE_NO_INSTALL)
- install(TARGETS ${EXENAME} DESTINATION bin)
+ install(TARGETS ${THIS_EXE_NAME} DESTINATION bin)
endif (NOT THIS_EXE_NO_INSTALL)
endif (THIS_EXE_OKAY)
endmacro(boost_add_executable)
\ No newline at end of file
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk