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
Keep the debug "d": a debug build is not the same library
- Commit
0f987a33220d3217a4e3e8416ce413f9983e3aa0- Author
- Leitwolf11 ·
- Parents
95e2cad52aa1
Changes
.github/workflows/linux-builds.yml | 7 ++++++- docs/progmasoft-catch3.md | 6 ++++-- src/CMakeLists.txt | 9 ++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-builds.yml b/.github/workflows/linux-builds.yml index 877b1501..16be72a1 100644 --- a/.github/workflows/linux-builds.yml +++ b/.github/workflows/linux-builds.yml @@ -74,14 +74,19 @@ jobs: #include <Progmasoft/Catch3.hpp> TEST_CASE("an installed Catch3 links by its name") { REQUIRE(1 + 1 == 2); } EOF + # A debug build is named apart with a "d". + d="" + if [ "$BUILD_TYPE" = Debug ]; then d=d; fi clang++ -std=c++${{matrix.std}} -I"$prefix/include" "$RUNNER_TEMP/consumer/test.cpp" \ - -L"$prefix/lib" -lCatch3Main -lCatch3 -o "$RUNNER_TEMP/consumer/by-name" + -L"$prefix/lib" "-lCatch3Main$d" "-lCatch3$d" -o "$RUNNER_TEMP/consumer/by-name" "$RUNNER_TEMP/consumer/by-name" export PKG_CONFIG_PATH="$prefix/share/pkgconfig" # shellcheck disable=SC2046 # pkg-config prints several flags. clang++ -std=c++${{matrix.std}} "$RUNNER_TEMP/consumer/test.cpp" \ $(pkg-config --cflags --libs catch3-with-main) -o "$RUNNER_TEMP/consumer/by-pkg-config" "$RUNNER_TEMP/consumer/by-pkg-config" + env: + BUILD_TYPE: ${{matrix.build_type}} thread-sanitizer: name: Ubuntu 26.04, C++17, ThreadSanitizer and UBSan diff --git a/docs/progmasoft-catch3.md b/docs/progmasoft-catch3.md index a28bc7e1..fadff6aa 100644 --- a/docs/progmasoft-catch3.md +++ b/docs/progmasoft-catch3.md @@ -181,8 +181,10 @@ target_link_libraries(MyTests PRIVATE Catch3::Catch3WithMain) Without a build system, an installed Catch3 links by its name: the library is `Catch3` and the one that brings `main` is `Catch3Main`, as `libCatch3.a` and -`libCatch3Main.a` (`Catch3.lib` and `Catch3Main.lib` on Windows), in every -build configuration. `Catch3Main` comes first, since it uses `Catch3`: +`libCatch3Main.a` (`Catch3.lib` and `Catch3Main.lib` on Windows). The released +archives and packages hold these release builds; a debug build made with +CMake is named apart, `Catch3d` and `Catch3Maind`. `Catch3Main` comes first, +since it uses `Catch3`: ```sh c++ -std=c++17 tests.cpp -lCatch3Main -lCatch3 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5e4cb935..f0de95b4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -399,10 +399,11 @@ target_link_libraries(Catch3 ) # The files are libCatch3 and libCatch3Main (Catch3.lib and Catch3Main.lib on -# Windows) in every configuration, so that an installed Catch3 links with -# -lCatch3 and -lCatch3Main. Released archives and packages hold release -# builds, so a debug build needs no name of its own. +# Windows), so that an installed Catch3 links with -lCatch3 and -lCatch3Main. +# A debug build is not the same library and is named apart with a "d"; the +# released archives and packages hold release builds. set_target_properties(Catch3 PROPERTIES + DEBUG_POSTFIX "d" VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION} ) @@ -437,6 +438,8 @@ set_target_properties(Catch3WithMain VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION} ) +set_target_properties(Catch3WithMain PROPERTIES DEBUG_POSTFIX "d") + if(NOT_SUBPROJECT) # Create and install an export set for the targets as Catch3::Catch3 and # Catch3::Catch3WithMain.