aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/catch2/examples/CMakeLists.txt
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-29 19:28:09 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-29 19:28:09 +0100
commit67b2fae1fa8b033045a44c1355d9dfd8f83e0d9b (patch)
tree1ecd818f4bcf7d12622d43dc92c4d4bb9b746d0f /contrib/catch2/examples/CMakeLists.txt
parenta8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df (diff)
parentbc524d70253a4ab2fe40c3ca3e5666e267c0a4d1 (diff)
downloadnihil-67b2fae1fa8b033045a44c1355d9dfd8f83e0d9b.tar.gz
nihil-67b2fae1fa8b033045a44c1355d9dfd8f83e0d9b.tar.bz2
Add 'contrib/catch2/' from commit 'bc524d70253a4ab2fe40c3ca3e5666e267c0a4d1'
git-subtree-dir: contrib/catch2 git-subtree-mainline: a8b0ea58e60bb0326b7f7c8f3c736d89ce9ef1df git-subtree-split: bc524d70253a4ab2fe40c3ca3e5666e267c0a4d1
Diffstat (limited to 'contrib/catch2/examples/CMakeLists.txt')
-rw-r--r--contrib/catch2/examples/CMakeLists.txt62
1 files changed, 62 insertions, 0 deletions
diff --git a/contrib/catch2/examples/CMakeLists.txt b/contrib/catch2/examples/CMakeLists.txt
new file mode 100644
index 0000000..d45ddfc
--- /dev/null
+++ b/contrib/catch2/examples/CMakeLists.txt
@@ -0,0 +1,62 @@
+cmake_minimum_required( VERSION 3.16 )
+
+project( Catch2Examples LANGUAGES CXX )
+
+message( STATUS "Examples included" )
+
+
+# Some one-offs first:
+# 1) Tests and main in one file
+add_executable( 010-TestCase
+ 010-TestCase.cpp
+)
+
+# 2) Tests and main across two files
+add_executable( 020-MultiFile
+ 020-TestCase-1.cpp
+ 020-TestCase-2.cpp
+)
+
+add_executable(231-Cfg_OutputStreams
+ 231-Cfg-OutputStreams.cpp
+)
+target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface)
+target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
+
+# These examples use the standard separate compilation
+set( SOURCES_IDIOMATIC_EXAMPLES
+ 030-Asn-Require-Check.cpp
+ 100-Fix-Section.cpp
+ 110-Fix-ClassFixture.cpp
+ 111-Fix-PersistentFixture.cpp
+ 120-Bdd-ScenarioGivenWhenThen.cpp
+ 210-Evt-EventListeners.cpp
+ 232-Cfg-CustomMain.cpp
+ 300-Gen-OwnGenerator.cpp
+ 301-Gen-MapTypeConversion.cpp
+ 302-Gen-Table.cpp
+ 310-Gen-VariablesInGenerators.cpp
+ 311-Gen-CustomCapture.cpp
+)
+
+string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}" )
+set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} )
+
+
+foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} )
+ add_executable( ${name} ${name}.cpp )
+endforeach()
+
+set(ALL_EXAMPLE_TARGETS
+ ${TARGETS_IDIOMATIC_EXAMPLES}
+ 010-TestCase
+ 020-MultiFile
+)
+
+foreach( name ${ALL_EXAMPLE_TARGETS} )
+ target_link_libraries( ${name} Catch2WithMain )
+endforeach()
+
+
+list(APPEND CATCH_WARNING_TARGETS ${ALL_EXAMPLE_TARGETS})
+set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)