Update Catch2 to v2.13.9, resolving a build error with GCC 11 #75

Open
jpetso wants to merge 1 commit from jpetso/catch2-v2.13.9 into master
jpetso commented 2022-08-21 11:47:57 -05:00 (Migrated from github.com)

Fixes #74

Fixes #74
cybaol commented 2024-03-05 06:03:57 -06:00 (Migrated from github.com)

I think it's time to Catch2 v3.

I think it's time to Catch2 v3.
anthraxx commented 2024-05-27 13:47:34 -05:00 (Migrated from github.com)

hitting this issue as well during distro packaging and we'd need support for catch v3. Is this project dead?

hitting this issue as well during distro packaging and we'd need support for catch v3. Is this project dead?
jpetso commented 2024-05-27 15:19:02 -05:00 (Migrated from github.com)

hitting this issue as well during distro packaging and we'd need support for catch v3. Is this project dead?

Possibly, I'm still looking at incoming PR/issue activity but haven't really taken the time to modernize the surrounding build infrastructure such as tests and CMake. Sorry. Found it more important/rewarding to work on KDE software instead. But also, I'll review any pull requests so if you're willing to contribute a patch, it can go in on short notice.

> hitting this issue as well during distro packaging and we'd need support for catch v3. Is this project dead? Possibly, I'm still looking at incoming PR/issue activity but haven't really taken the time to modernize the surrounding build infrastructure such as tests and CMake. Sorry. Found it more important/rewarding to work on KDE software instead. But also, I'll review any pull requests so if you're willing to contribute a patch, it can go in on short notice.
jpetso commented 2024-05-27 15:20:50 -05:00 (Migrated from github.com)

But also it's the Arch project leader personally, so maybe I can make an exception and take some time for this. Love your distro, have been using it on both my laptop and desktop for years!

But also it's the Arch project leader personally, so maybe I can make an exception and take some time for this. Love your distro, have been using it on both my laptop and desktop for years!
jpetso commented 2024-08-21 03:25:52 -05:00 (Migrated from github.com)

Hi, I'm sorry that this issue has still not seen any movement. As a workaround, consider building with -D CPPCODEC_BUILD_TESTING=0 to exclude tests from the build.

Hi, I'm sorry that this issue has still not seen any movement. As a workaround, consider building with `-D CPPCODEC_BUILD_TESTING=0` to exclude tests from the build.
anthraxx commented 2024-08-21 06:03:40 -05:00 (Migrated from github.com)

I'd rather not drop tests. In general running tests in the actual Arch env are a nice safeguard that repeatedly safe us from potentially releasing unexpected breakage.
We'd very much appreciate it if we can keep tests.

I'd rather not drop tests. In general running tests in the actual Arch env are a nice safeguard that repeatedly safe us from potentially releasing unexpected breakage. We'd very much appreciate it if we can keep tests.
loqs commented 2026-04-14 15:32:56 -05:00 (Migrated from github.com)

@jpetso updating to catch2 v3 should be relatively simple (does the following work for you):
Switch from pkg_check_modules to find_package this will make linking with V3 easier:

--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,11 +1,7 @@
-find_package(PkgConfig)
-if(PKG_CONFIG_FOUND)
-    pkg_check_modules(CATCH2 catch2)
-endif()
+find_package(Catch2 CONFIG QUIET)
 
-if(CATCH2_FOUND)
+if(Catch2_FOUND)
     message(STATUS "Found system Catch2, not using bundled version")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CATCH2_CFLAGS}")
 else()
     message(STATUS "Did NOT find system Catch2, instead using bundled version")
     include_directories(${CMAKE_CURRENT_SOURCE_DIR}/catch/single_include)
  • Update test/catch submodule to v3.14.0
  • Update test/CMakeLists.txt to use Catch v3's CMake integration via add_subdirectory(catch) and link against Catch2::Catch2WithMain
  • Update test/test_cppcodec.cpp to use catch_all.hpp instead of catch.hpp
  • C++ standard will be upgrade to C++ 14 for the tests as required by Catch v3
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 39fceba..10abce2 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -8,13 +8,13 @@ if(CATCH2_FOUND)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CATCH2_CFLAGS}")
 else()
     message(STATUS "Did NOT find system Catch2, instead using bundled version")
-    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/catch/single_include)
+    add_subdirectory(catch)
 endif()
 
 add_compile_options(${CPPCODEC_PRIVATE_COMPILE_OPTIONS})
 
 add_executable(test_cppcodec test_cppcodec.cpp)
-target_link_libraries(test_cppcodec cppcodec)
+target_link_libraries(test_cppcodec cppcodec Catch2::Catch2WithMain)
 add_test(NAME cppcodec COMMAND test_cppcodec)
 
 add_executable(benchmark_cppcodec benchmark_cppcodec.cpp)
diff --git a/test/catch b/test/catch
index 15cf3ca..b670de4 160000
--- a/test/catch
+++ b/test/catch
@@ -1 +1 @@
-Subproject commit 15cf3caaceb21172ea42a24e595a2eb58c3ec960
+Subproject commit b670de4fe12ac7c5e858b7de3a14fb4bd18c760e
diff --git a/test/test_cppcodec.cpp b/test/test_cppcodec.cpp
index d7e50bc..1d6662b 100644
--- a/test/test_cppcodec.cpp
+++ b/test/test_cppcodec.cpp
@@ -22,7 +22,7 @@
  */
 
 #define CATCH_CONFIG_MAIN
-#include <catch2/catch.hpp>
+#include <catch2/catch_all.hpp>
 
 #include <cppcodec/base32_crockford.hpp>
 #include <cppcodec/base32_hex.hpp>

Reduction to minimal headers from catch_all.hpp:

diff --git a/test/test_cppcodec.cpp b/test/test_cppcodec.cpp
index 1d6662b..0577fb9 100644
--- a/test/test_cppcodec.cpp
+++ b/test/test_cppcodec.cpp
@@ -22,7 +22,7 @@
  */
 
 #define CATCH_CONFIG_MAIN
-#include <catch2/catch_all.hpp>
+#include <catch2/catch_test_macros.hpp>
 
 #include <cppcodec/base32_crockford.hpp>
 #include <cppcodec/base32_hex.hpp>
@jpetso updating to catch2 v3 should be relatively simple (does the following work for you): Switch from pkg_check_modules to find_package this will make linking with V3 easier: ```patch --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,11 +1,7 @@ -find_package(PkgConfig) -if(PKG_CONFIG_FOUND) - pkg_check_modules(CATCH2 catch2) -endif() +find_package(Catch2 CONFIG QUIET) -if(CATCH2_FOUND) +if(Catch2_FOUND) message(STATUS "Found system Catch2, not using bundled version") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CATCH2_CFLAGS}") else() message(STATUS "Did NOT find system Catch2, instead using bundled version") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/catch/single_include) ``` - Update test/catch submodule to v3.14.0 - Update test/CMakeLists.txt to use Catch v3's CMake integration via add_subdirectory(catch) and link against Catch2::Catch2WithMain - Update test/test_cppcodec.cpp to use catch_all.hpp instead of catch.hpp - C++ standard will be upgrade to C++ 14 for the tests as required by Catch v3 ```patch diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 39fceba..10abce2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,13 +8,13 @@ if(CATCH2_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CATCH2_CFLAGS}") else() message(STATUS "Did NOT find system Catch2, instead using bundled version") - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/catch/single_include) + add_subdirectory(catch) endif() add_compile_options(${CPPCODEC_PRIVATE_COMPILE_OPTIONS}) add_executable(test_cppcodec test_cppcodec.cpp) -target_link_libraries(test_cppcodec cppcodec) +target_link_libraries(test_cppcodec cppcodec Catch2::Catch2WithMain) add_test(NAME cppcodec COMMAND test_cppcodec) add_executable(benchmark_cppcodec benchmark_cppcodec.cpp) diff --git a/test/catch b/test/catch index 15cf3ca..b670de4 160000 --- a/test/catch +++ b/test/catch @@ -1 +1 @@ -Subproject commit 15cf3caaceb21172ea42a24e595a2eb58c3ec960 +Subproject commit b670de4fe12ac7c5e858b7de3a14fb4bd18c760e diff --git a/test/test_cppcodec.cpp b/test/test_cppcodec.cpp index d7e50bc..1d6662b 100644 --- a/test/test_cppcodec.cpp +++ b/test/test_cppcodec.cpp @@ -22,7 +22,7 @@ */ #define CATCH_CONFIG_MAIN -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <cppcodec/base32_crockford.hpp> #include <cppcodec/base32_hex.hpp> ``` Reduction to minimal headers from catch_all.hpp: ```patch diff --git a/test/test_cppcodec.cpp b/test/test_cppcodec.cpp index 1d6662b..0577fb9 100644 --- a/test/test_cppcodec.cpp +++ b/test/test_cppcodec.cpp @@ -22,7 +22,7 @@ */ #define CATCH_CONFIG_MAIN -#include <catch2/catch_all.hpp> +#include <catch2/catch_test_macros.hpp> #include <cppcodec/base32_crockford.hpp> #include <cppcodec/base32_hex.hpp> ```
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'jpetso/catch2-v2.13.9:jpetso/catch2-v2.13.9'
git switch 'jpetso/catch2-v2.13.9'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'jpetso/catch2-v2.13.9'
git switch 'jpetso/catch2-v2.13.9'
git rebase 'master'
git switch 'master'
git merge --ff-only 'jpetso/catch2-v2.13.9'
git switch 'jpetso/catch2-v2.13.9'
git rebase 'master'
git switch 'master'
git merge --no-ff 'jpetso/catch2-v2.13.9'
git switch 'master'
git merge --squash 'jpetso/catch2-v2.13.9'
git switch 'master'
git merge --ff-only 'jpetso/catch2-v2.13.9'
git switch 'master'
git merge 'jpetso/catch2-v2.13.9'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-tplgy/cppcodec!75
No description provided.