File tree 15 files changed +99
-19
lines changed 15 files changed +99
-19
lines changed Original file line number Diff line number Diff line change 1
1
## Changelog
2
2
3
+ ## [ 3.3.1] - 2025-01-22
4
+ ### Fixed
5
+ - fixed tests not building with catch2 versions >= 3.0
6
+
3
7
## [ 3.3.0] - 2025-01-18
4
8
### Changed
5
9
- add C++11 and C++14 support
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
32
32
message (FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR} /CMakeCache.txt" )
33
33
endif ()
34
34
35
- project (rapidfuzz LANGUAGES CXX VERSION 3.3.0 )
35
+ project (rapidfuzz LANGUAGES CXX VERSION 3.3.1 )
36
36
37
37
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR} /cmake" )
38
38
include (GNUInstallDirs)
Original file line number Diff line number Diff line change 1
- find_package (Catch2 2 QUIET )
1
+ find_package (Catch2 QUIET )
2
2
if (Catch2_FOUND)
3
3
message ("Using system supplied version of Catch2" )
4
4
else ()
10
10
GIT_TAG v2.13.10
11
11
)
12
12
FetchContent_MakeAvailable(Catch2)
13
+ set (Catch2_VERSION "2.13.10" )
13
14
endif ()
14
15
15
16
if (RAPIDFUZZ_ENABLE_LINTERS)
@@ -50,11 +51,19 @@ if (RAPIDFUZZ_ENABLE_LINTERS)
50
51
endif ()
51
52
52
53
function (rapidfuzz_add_test test )
53
- add_executable (test_${test} tests-main.cpp tests-${test} .cpp)
54
- target_link_libraries (test_${test} ${PROJECT_NAME} )
55
- target_link_libraries (test_${test} Catch2::Catch2)
54
+ if (Catch2_VERSION VERSION_LESS "3.0" )
55
+ add_executable (test_${test} tests-main.cpp tests-${test} .cpp)
56
+ target_link_libraries (test_${test} PRIVATE Catch2::Catch2)
57
+ target_compile_definitions (test_${test} PRIVATE CATCH2_VERSION=2)
58
+ else ()
59
+ add_executable (test_${test} tests-${test} .cpp)
60
+ target_link_libraries (test_${test} PRIVATE Catch2::Catch2WithMain)
61
+ target_compile_definitions (test_${test} PRIVATE CATCH2_VERSION=3)
62
+ endif ()
63
+
64
+ target_link_libraries (test_${test} PRIVATE ${PROJECT_NAME} )
56
65
if (RAPIDFUZZ_ENABLE_LINTERS)
57
- target_link_libraries (test_${test} project_warnings)
66
+ target_link_libraries (test_${test} PRIVATE project_warnings)
58
67
endif ()
59
68
add_test (NAME ${test} COMMAND test_${test} )
60
69
endfunction ()
Original file line number Diff line number Diff line change 1
1
function (rapidfuzz_add_test test )
2
- add_executable (test_${test} ../tests-main.cpp tests-${test} .cpp examples/ocr.cpp examples/pythonLevenshteinIssue9.cpp)
2
+ if (Catch2_VERSION VERSION_LESS "3.0" )
3
+ add_executable (test_${test} ../tests-main.cpp tests-${test} .cpp examples/ocr.cpp examples/pythonLevenshteinIssue9.cpp)
4
+ target_link_libraries (test_${test} PRIVATE Catch2::Catch2)
5
+ target_compile_definitions (test_${test} PRIVATE CATCH2_VERSION=2)
6
+ else ()
7
+ add_executable (test_${test} tests-${test} .cpp examples/ocr.cpp examples/pythonLevenshteinIssue9.cpp)
8
+ target_link_libraries (test_${test} PRIVATE Catch2::Catch2WithMain)
9
+ target_compile_definitions (test_${test} PRIVATE CATCH2_VERSION=3)
10
+ endif ()
11
+
3
12
target_link_libraries (test_${test} PRIVATE ${PROJECT_NAME} )
4
- target_link_libraries (test_${test} PRIVATE Catch2::Catch2)
5
13
if (RAPIDFUZZ_ENABLE_LINTERS)
6
14
target_link_libraries (test_${test} PRIVATE project_warnings)
7
15
endif ()
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < rapidfuzz/details/Range.hpp>
3
9
#include < rapidfuzz/details/types.hpp>
4
10
#include < string>
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < rapidfuzz/distance.hpp>
3
9
#include < rapidfuzz/distance/Hamming.hpp>
4
10
#include < string>
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < string>
3
9
4
10
#include < rapidfuzz/distance.hpp>
Original file line number Diff line number Diff line change
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
1
8
#include " ../../rapidfuzz_reference/Jaro.hpp"
2
- #include < catch2/catch.hpp>
3
9
#include < rapidfuzz/distance/Jaro.hpp>
4
10
5
11
#include " ../common.hpp"
Original file line number Diff line number Diff line change
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
1
8
#include " ../../rapidfuzz_reference/JaroWinkler.hpp"
2
- #include < catch2/catch.hpp>
3
9
#include < rapidfuzz/distance/JaroWinkler.hpp>
4
10
5
11
#include " ../common.hpp"
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < rapidfuzz/distance/LCSseq.hpp>
3
9
#include < string>
4
10
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < rapidfuzz/details/Range.hpp>
3
9
#include < rapidfuzz/details/types.hpp>
4
10
#include < rapidfuzz/distance/Levenshtein.hpp>
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
7
+
2
8
#include < rapidfuzz/details/types.hpp>
3
9
#include < rapidfuzz/distance/OSA.hpp>
4
10
#include < string>
Original file line number Diff line number Diff line change 1
1
#include " rapidfuzz/details/Range.hpp"
2
- #include < catch2/catch.hpp>
2
+
3
+ #if CATCH2_VERSION == 2
4
+ # include < catch2/catch.hpp>
5
+ #else
6
+ # include < catch2/catch_approx.hpp>
7
+ # include < catch2/catch_test_macros.hpp>
8
+ #endif
3
9
4
10
#include < rapidfuzz/details/common.hpp>
5
11
Original file line number Diff line number Diff line change 1
- #include < catch2/catch.hpp>
1
+ #if CATCH2_VERSION == 2
2
+ # include < catch2/catch.hpp>
3
+ #else
4
+ # include < catch2/catch_test_macros.hpp>
5
+ # include < catch2/matchers/catch_matchers_floating_point.hpp>
6
+ #endif
2
7
3
8
#include < rapidfuzz/fuzz.hpp>
4
9
Original file line number Diff line number Diff line change 1
1
// test main file so catch2 does not has to be recompiled
2
2
#define CATCH_CONFIG_MAIN
3
- #include " catch2/catch.hpp"
3
+ #include < catch2/catch.hpp>
You can’t perform that action at this time.
0 commit comments