Commit 8f3f0ea1 authored by Andriy Senkovych's avatar Andriy Senkovych

Add separate targets for examples and tests

parent 6f7789ef
...@@ -17,3 +17,5 @@ set(EXAMPLES ...@@ -17,3 +17,5 @@ set(EXAMPLES
foreach (example ${EXAMPLES}) foreach (example ${EXAMPLES})
add_executable(${example} ${example}/${example}.cpp) add_executable(${example} ${example}/${example}.cpp)
endforeach() endforeach()
add_custom_target(examples ALL DEPENDS ${EXAMPLES})
...@@ -12,6 +12,8 @@ IF(GTESTSRC_FOUND) ...@@ -12,6 +12,8 @@ IF(GTESTSRC_FOUND)
set(TEST_LIBRARIES gtest gtest_main) set(TEST_LIBRARIES gtest gtest_main)
add_custom_target(tests ALL)
add_subdirectory(perftest) add_subdirectory(perftest)
add_subdirectory(unittest) add_subdirectory(unittest)
ENDIF(GTESTSRC_FOUND) ENDIF(GTESTSRC_FOUND)
...@@ -6,6 +6,9 @@ set(PERFTEST_SOURCES ...@@ -6,6 +6,9 @@ set(PERFTEST_SOURCES
add_executable(perftest ${PERFTEST_SOURCES}) add_executable(perftest ${PERFTEST_SOURCES})
target_link_libraries(perftest ${TEST_LIBRARIES}) target_link_libraries(perftest ${TEST_LIBRARIES})
add_dependencies(tests perftest)
add_test(NAME perftest add_test(NAME perftest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perftest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perftest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
...@@ -12,6 +12,9 @@ set(UNITTEST_SOURCES ...@@ -12,6 +12,9 @@ set(UNITTEST_SOURCES
add_executable(unittest ${UNITTEST_SOURCES}) add_executable(unittest ${UNITTEST_SOURCES})
target_link_libraries(unittest ${TEST_LIBRARIES}) target_link_libraries(unittest ${TEST_LIBRARIES})
add_dependencies(tests unittest)
add_test(NAME unittest add_test(NAME unittest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment