BUILD_TESTS condition

This commit is contained in:
Marius Bancila 2018-11-16 10:38:09 +02:00
parent cb5a727a4a
commit 81fc825a5b
3 changed files with 18 additions and 14 deletions

View File

@ -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:

View File

@ -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)
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()

View File

@ -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