Add separate targets for examples and tests

This commit is contained in:
Andriy Senkovych 2014-11-11 17:50:32 +02:00
parent 6f7789ef6d
commit 8f3f0ea167
4 changed files with 10 additions and 0 deletions

View File

@ -17,3 +17,5 @@ set(EXAMPLES
foreach (example ${EXAMPLES})
add_executable(${example} ${example}/${example}.cpp)
endforeach()
add_custom_target(examples ALL DEPENDS ${EXAMPLES})

View File

@ -12,6 +12,8 @@ IF(GTESTSRC_FOUND)
set(TEST_LIBRARIES gtest gtest_main)
add_custom_target(tests ALL)
add_subdirectory(perftest)
add_subdirectory(unittest)
ENDIF(GTESTSRC_FOUND)

View File

@ -6,6 +6,9 @@ set(PERFTEST_SOURCES
add_executable(perftest ${PERFTEST_SOURCES})
target_link_libraries(perftest ${TEST_LIBRARIES})
add_dependencies(tests perftest)
add_test(NAME perftest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perftest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

View File

@ -12,6 +12,9 @@ set(UNITTEST_SOURCES
add_executable(unittest ${UNITTEST_SOURCES})
target_link_libraries(unittest ${TEST_LIBRARIES})
add_dependencies(tests unittest)
add_test(NAME unittest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)