diff options
Diffstat (limited to 'externals/find-modules/FindCatch2.cmake')
| -rw-r--r-- | externals/find-modules/FindCatch2.cmake | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake new file mode 100644 index 000000000..a83c668bf --- /dev/null +++ b/externals/find-modules/FindCatch2.cmake | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | |||
| 2 | find_package(PkgConfig QUIET) | ||
| 3 | pkg_check_modules(PC_Catch2 QUIET Catch2) | ||
| 4 | |||
| 5 | find_path(Catch2_INCLUDE_DIR | ||
| 6 | NAMES catch.hpp | ||
| 7 | PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT} | ||
| 8 | PATH_SUFFIXES catch2 | ||
| 9 | ) | ||
| 10 | |||
| 11 | include(FindPackageHandleStandardArgs) | ||
| 12 | find_package_handle_standard_args(Catch2 | ||
| 13 | FOUND_VAR Catch2_FOUND | ||
| 14 | REQUIRED_VARS | ||
| 15 | Catch2_INCLUDE_DIR | ||
| 16 | VERSION_VAR Catch2_VERSION | ||
| 17 | ) | ||
| 18 | |||
| 19 | if(Catch2_FOUND) | ||
| 20 | set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR}) | ||
| 21 | set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER}) | ||
| 22 | endif() | ||
| 23 | |||
| 24 | if(Catch2_FOUND AND NOT TARGET Catch2::Catch2) | ||
| 25 | add_library(Catch2::Catch2 UNKNOWN IMPORTED) | ||
| 26 | set_target_properties(Catch2::Catch2 PROPERTIES | ||
| 27 | IMPORTED_LOCATION "${Catch2_LIBRARY}" | ||
| 28 | INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}" | ||
| 29 | INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}" | ||
| 30 | ) | ||
| 31 | endif() | ||
| 32 | |||
| 33 | mark_as_advanced( | ||
| 34 | Catch2_INCLUDE_DIR | ||
| 35 | ) | ||