From 81fc825a5b4f020d6ae54a0d1878d888fbbe5b48 Mon Sep 17 00:00:00 2001 From: Marius Bancila Date: Fri, 16 Nov 2018 10:38:09 +0200 Subject: [PATCH] BUILD_TESTS condition --- .travis.yml | 2 +- CMakeLists.txt | 28 ++++++++++++++++------------ appveyor.yml | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f63683..49c1b88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: before_script: - cd ${TRAVIS_BUILD_DIR} - - cmake -H. -BBuild -DCMAKE_BUILD_TYPE=Release -Wdev + - cmake -H. -BBuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -Wdev - cd Build script: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0551318..77ed0ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,9 @@ include_directories(${CMAKE_SOURCE_DIR}/catch) file(GLOB headers ${CMAKE_SOURCE_DIR}/include/*.h) file(GLOB SOURCES "test/*.cpp" "include/*.cpp") -include(CTest) +if(BUILD_TESTS) + include(CTest) +endif() if(WIN32) message(status "Setting MSVC flags") @@ -39,15 +41,17 @@ endif() message(status "** CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") -enable_testing() +if(BUILD_TESTS) + enable_testing() -add_test(NAME "test_uuid" COMMAND "test_uuid" "-r compact") -set_tests_properties("test_uuid" - PROPERTIES - PASS_REGULAR_EXPRESSION "Passed all.*") -set_tests_properties("test_uuid" - PROPERTIES - FAIL_REGULAR_EXPRESSION "Failed \\d+ test cases") -set_tests_properties("test_uuid" - PROPERTIES - TIMEOUT 120) \ No newline at end of file + add_test(NAME "test_uuid" COMMAND "test_uuid" "-r compact") + set_tests_properties("test_uuid" + PROPERTIES + PASS_REGULAR_EXPRESSION "Passed all.*") + set_tests_properties("test_uuid" + PROPERTIES + FAIL_REGULAR_EXPRESSION "Failed \\d+ test cases") + set_tests_properties("test_uuid" + PROPERTIES + TIMEOUT 120) +endif() \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 0032df0..458dda3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,7 @@ init: before_build: - mkdir build - cd build - - cmake .. -G "%GENERATOR%" -DCMAKE_CXX_FLAGS="%FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" + - cmake .. -G "%GENERATOR%" -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="%FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" build_script: - cmake --build . --config Release