mirror of
https://github.com/catchorg/Catch2.git
synced 2025-04-28 19:53:52 +00:00
Compare commits
No commits in common. "4005d87460cbcda69532fc04cbbef4e4bf0f7616" and "add7068f21cfcc6782c661a3d6ee39dc9372d98b" have entirely different histories.
4005d87460
...
add7068f21
@ -9,7 +9,6 @@ endif()
|
||||
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
||||
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
||||
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
|
||||
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
||||
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
||||
option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON)
|
||||
|
||||
@ -62,6 +61,7 @@ if(CATCH_BUILD_EXTRA_TESTS)
|
||||
endif()
|
||||
|
||||
#option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" 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)
|
||||
|
@ -10,6 +10,11 @@ coverage:
|
||||
default:
|
||||
target: 80%
|
||||
ignore:
|
||||
- "projects/SelfTest"
|
||||
- "**/catch_reporter_tap.hpp"
|
||||
- "**/catch_reporter_automake.hpp"
|
||||
- "**/catch_reporter_teamcity.hpp"
|
||||
- "**/catch_reporter_sonarqube.hpp"
|
||||
- "**/external/clara.hpp"
|
||||
|
||||
|
||||
|
@ -224,15 +224,23 @@ add_library(Catch2 STATIC
|
||||
${BENCHMARK_HEADERS}
|
||||
${BENCHMARK_SOURCES}
|
||||
)
|
||||
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||
|
||||
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
||||
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||
if (ANDROID)
|
||||
target_link_libraries(Catch2 INTERFACE log)
|
||||
endif()
|
||||
|
||||
|
||||
target_include_directories(Catch2
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
# depend on bunch of C++11 and C++14 features to have C++14 enabled by default
|
||||
target_compile_features(Catch2
|
||||
PUBLIC
|
||||
INTERFACE
|
||||
cxx_alignas
|
||||
cxx_alignof
|
||||
cxx_attributes
|
||||
@ -255,27 +263,11 @@ target_compile_features(Catch2
|
||||
cxx_variadic_macros
|
||||
)
|
||||
|
||||
target_include_directories(Catch2
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
|
||||
add_library(Catch2Main STATIC
|
||||
${SOURCES_DIR}/catch_main.cpp
|
||||
)
|
||||
add_library(Catch2::Catch2Main ALIAS Catch2Main)
|
||||
target_link_libraries(Catch2Main PUBLIC Catch2)
|
||||
|
||||
|
||||
|
||||
if (NOT_SUBPROJECT)
|
||||
# create and install an export set for catch target as Catch2::Catch
|
||||
install(
|
||||
TARGETS
|
||||
Catch2
|
||||
Catch2Main
|
||||
EXPORT
|
||||
Catch2Targets
|
||||
DESTINATION
|
||||
@ -291,8 +283,9 @@ if (NOT_SUBPROJECT)
|
||||
DESTINATION
|
||||
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||
)
|
||||
# Install the headers
|
||||
# This installs the headers
|
||||
install(DIRECTORY ${SOURCES_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*")
|
||||
# TODO: Also install the helper main
|
||||
endif()
|
||||
|
||||
# Some tests require a full recompilation of Catch2 lib with different
|
||||
|
@ -1,6 +0,0 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include <catch2/catch_default_main.hpp>
|
@ -75,7 +75,7 @@ set(HEADERS
|
||||
${EXTERNAL_HEADERS}
|
||||
${INTERNAL_HEADERS}
|
||||
${REPORTER_HEADERS}
|
||||
${BENCHMARK_HEADERS}
|
||||
${BENCHMARK_HEADERS}
|
||||
${BENCHMARK_SOURCES}
|
||||
)
|
||||
|
||||
@ -89,6 +89,33 @@ include(CTest)
|
||||
add_executable(SelfTest ${TEST_SOURCES})
|
||||
target_link_libraries(SelfTest PRIVATE Catch2)
|
||||
|
||||
# It took CMake until 3.8 to abandon the doomed approach of enumerating
|
||||
# required features so we just list bunch of C++11 and C++14 features.
|
||||
target_compile_features(SelfTest
|
||||
PRIVATE
|
||||
cxx_alignas
|
||||
cxx_alignof
|
||||
cxx_attributes
|
||||
cxx_auto_type
|
||||
cxx_constexpr
|
||||
cxx_defaulted_functions
|
||||
cxx_deleted_functions
|
||||
cxx_final
|
||||
cxx_lambdas
|
||||
cxx_noexcept
|
||||
cxx_override
|
||||
cxx_range_for
|
||||
cxx_rvalue_references
|
||||
cxx_static_assert
|
||||
cxx_strong_enums
|
||||
cxx_trailing_return_types
|
||||
cxx_unicode_literals
|
||||
cxx_user_literals
|
||||
cxx_variadic_macros
|
||||
cxx_variable_templates
|
||||
)
|
||||
|
||||
|
||||
if (CATCH_ENABLE_COVERAGE)
|
||||
set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
|
||||
find_package(codecov)
|
||||
@ -222,11 +249,6 @@ set_tests_properties(TestsInFile::InvalidTestNames-1 PROPERTIES PASS_REGULAR_EXP
|
||||
add_test(NAME TestsInFile::InvalidTestNames-2 COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/invalid-test-names.input")
|
||||
set_tests_properties(TestsInFile::InvalidTestNames-2 PROPERTIES PASS_REGULAR_EXPRESSION "No tests ran")
|
||||
|
||||
add_test(NAME TagAlias COMMAND $<TARGET_FILE:SelfTest> [@tricky] --list-tests)
|
||||
set_tests_properties(TagAlias PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "[0-9]+ matching test cases"
|
||||
FAIL_REGULAR_EXPRESSION "0 matching test cases"
|
||||
)
|
||||
|
||||
if (CATCH_USE_VALGRIND)
|
||||
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
|
||||
|
Loading…
x
Reference in New Issue
Block a user