From 343678a02015c7f47d18cb49396bf889463d11ef Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 9 Sep 2015 19:19:58 +0200 Subject: [PATCH] Removed samples building from 'all' target --- .travis.yml | 1 + CMakeLists.txt | 3 ++- appveyor.yml | 1 + samples/CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 8 +++++--- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25cd6d2..dd3282b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ script: - cd build - cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$HOME -DCMAKE_INSTALL_PREFIX=criterion-${TRAVIS_TAG} .. - make +- make criterion_tests - make test after_success: - make coveralls diff --git a/CMakeLists.txt b/CMakeLists.txt index 8165f2e..f82d4fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,7 +167,8 @@ install(TARGETS criterion ARCHIVE DESTINATION lib ) +add_custom_target(criterion_tests) + enable_testing() add_subdirectory(samples) add_subdirectory(test) - diff --git a/appveyor.yml b/appveyor.yml index 96d4291..66c09d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,6 +52,7 @@ before_deploy: Push-AppveyorArtifact "../$archive.tar.bz2" test_script: + - cmake --build . --target criterion_tests - ps: try { ctest } catch { type Testing/Temporary/LastTest.log } #after_test: diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 1dfbaca..038f8c2 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -40,9 +40,13 @@ if (HAVE_PCRE) set(SCRIPTS ${SCRIPTS} pattern) endif () +add_custom_target(criterion_samples) +add_dependencies(criterion_tests criterion_samples) + macro(add_samples DIR_ SAMPLES_) foreach(sample ${SAMPLES_}) - add_executable(${sample}.bin ${sample}) + add_executable(${sample}.bin EXCLUDE_FROM_ALL ${sample}) + add_dependencies(criterion_samples ${sample}.bin) target_link_libraries(${sample}.bin criterion) add_test(${sample} ${sample}.bin) set_property(TEST ${sample} PROPERTY diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2a575a5..d9122f2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,7 +8,9 @@ set(TEST_SOURCES ordered-set.c ) -add_executable(test_criterion ${TEST_SOURCES}) -target_link_libraries(test_criterion criterion) +add_executable(criterion_unit_tests EXCLUDE_FROM_ALL ${TEST_SOURCES}) +target_link_libraries(criterion_unit_tests criterion) -add_test(test_criterion test_criterion) +add_dependencies(criterion_tests criterion_unit_tests) + +add_test(criterion_unit_tests criterion_unit_tests)