CMake trick: use set_property and the property COMPILE_DEFINITIONS to build

two different executable from one source.
This commit is contained in:
Laurent Rineau 2011-03-16 14:01:54 +00:00
parent 0223ee8abb
commit 1086527e03
1 changed files with 10 additions and 5 deletions

View File

@ -22,13 +22,18 @@ if ( CGAL_FOUND )
include_directories (BEFORE ../../include)
option(ONLY_TEST_COMPARISONS "Check comparisons of doubles instead of Orientation_3")
add_executable( bench_orientation_3 "orientation_3.cpp" )
target_link_libraries(bench_orientation_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
if(ONLY_TEST_COMPARISONS)
add_definitions(-DONLY_TEST_COMPARISONS)
endif()
create_single_source_cgal_program( "orientation_3.cpp" )
add_executable( bench_comparisons "orientation_3.cpp" )
target_link_libraries(bench_comparisons ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
set_property(
TARGET bench_comparisons
APPEND
PROPERTY COMPILE_DEFINITIONS ONLY_TEST_COMPARISONS )
get_property(DEF TARGET bench_comparisons PROPERTY COMPILE_DEFINITIONS)
message("DEF = ${DEF}")
else()