Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Namespace Catch CMake options

Commit
b0f4f16ee09d168c9a78108191530fa606ee4e2c
Author
David Seifert ·
Committer
Martin Hořeňovský
Parents
1e3ddbb49671

Files · Download .tar.gz

Changes

 .travis.yml                               |  2 +-
 CMakeLists.txt                            | 19 ++++++++++---------
 examples/CMakeLists.txt                   |  2 +-
 misc/appveyorBuildConfigurationScript.bat |  2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 5e98ce4f..1da1c0fc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -204,7 +204,7 @@ before_script:
 
   - |
     # Use Debug builds for running Valgrind and building examples
-    cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DUSE_CPP14=${CPP14} -DUSE_VALGRIND=${VALGRIND} -DBUILD_EXAMPLES=ON -DENABLE_COVERAGE=ON
+    cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DUSE_CPP14=${CPP14} -DCATCH_USE_VALGRIND=${VALGRIND} -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_COVERAGE=ON
     # Don't bother with release build for coverage build
     cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release -Wdev -DUSE_CPP14=${CPP14}
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfb1f857..3e631097 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,10 +10,10 @@ project(Catch2 LANGUAGES CXX VERSION 2.1.0)
 
 include(GNUInstallDirs)
 
-option(USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
-option(BUILD_EXAMPLES "Build documentation examples" OFF)
-option(ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
-option(DISABLE_WERROR "Do not enable warnings as errors" OFF)
+option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
+option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
+option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
+option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
@@ -319,7 +319,8 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
     set_property(TARGET SelfTest PROPERTY CXX_STANDARD_REQUIRED ON)
     set_property(TARGET SelfTest PROPERTY CXX_EXTENSIONS OFF)
 
-    if (ENABLE_COVERAGE)
+    if (CATCH_ENABLE_COVERAGE)
+        set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
         list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
         find_package(codecov)
         add_coverage(SelfTest)
@@ -330,7 +331,7 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
     # Add desired warnings
     if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
         target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code )
-        if (NOT DISABLE_WERROR)
+        if (CATCH_ENABLE_WERROR)
             target_compile_options( SelfTest PRIVATE -Werror)
         endif()
     endif()
@@ -342,7 +343,7 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
     if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
 		STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level
         target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 )
-        if (NOT DISABLE_WERROR)
+        if (CATCH_ENABLE_WERROR)
             target_compile_options( SelfTest PRIVATE /WX)
         endif()
     endif()
@@ -370,7 +371,7 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
     add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
     set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
 
-    if (USE_VALGRIND)
+    if (CATCH_USE_VALGRIND)
         add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
         add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
         set_tests_properties(ValgrindListTests PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
@@ -381,7 +382,7 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
 endif() # !NO_SELFTEST
 
 
-if(BUILD_EXAMPLES)
+if(CATCH_BUILD_EXAMPLES)
     add_subdirectory(examples)
 endif()
 
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 9f7c7fae..7270e933 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,7 +1,7 @@
 #
 # Build examples.
 #
-# Requires BUILD_EXAMPLES to be defined 'true', see ../CMakeLists.txt.
+# Requires CATCH_BUILD_EXAMPLES to be defined 'true', see ../CMakeLists.txt.
 #
 
 cmake_minimum_required( VERSION 3.0 )
diff --git a/misc/appveyorBuildConfigurationScript.bat b/misc/appveyorBuildConfigurationScript.bat
index c70da86d..27efcd10 100644
--- a/misc/appveyorBuildConfigurationScript.bat
+++ b/misc/appveyorBuildConfigurationScript.bat
@@ -6,7 +6,7 @@ if "%CONFIGURATION%"=="Debug" (
   python scripts\generateSingleHeader.py
   cmake -Hmisc -Bbuild-misc -A%PLATFORM%
   cmake --build build-misc
-  cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DBUILD_EXAMPLES=ON -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind
+  cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind
 )
 if "%CONFIGURATION%"=="Release" (
   cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain%