summaryrefslogtreecommitdiff
path: root/externals/find-modules/FindCatch2.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'externals/find-modules/FindCatch2.cmake')
-rw-r--r--externals/find-modules/FindCatch2.cmake51
1 files changed, 0 insertions, 51 deletions
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake
deleted file mode 100644
index bded15951..000000000
--- a/externals/find-modules/FindCatch2.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
1# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later
3
4find_package(PkgConfig QUIET)
5pkg_check_modules(PC_Catch2 QUIET Catch2)
6
7find_path(Catch2_INCLUDE_DIR
8 NAMES catch.hpp
9 PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT}
10 PATH_SUFFIXES catch2
11)
12
13if(Catch2_INCLUDE_DIR)
14 file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
15 REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
16 string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
17 string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
18 string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
19 set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
20 unset(_Catch2_version_major)
21 unset(_Catch2_version_minor)
22 unset(_Catch2_version_patch)
23 unset(_Catch2_version_lines)
24endif()
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(Catch2
28 FOUND_VAR Catch2_FOUND
29 REQUIRED_VARS
30 Catch2_INCLUDE_DIR
31 Catch2_VERSION
32 VERSION_VAR Catch2_VERSION
33)
34
35if(Catch2_FOUND)
36 set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR})
37 set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER})
38endif()
39
40if(Catch2_FOUND AND NOT TARGET Catch2::Catch2)
41 add_library(Catch2::Catch2 UNKNOWN IMPORTED)
42 set_target_properties(Catch2::Catch2 PROPERTIES
43 IMPORTED_LOCATION "${Catch2_LIBRARY}"
44 INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}"
45 INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}"
46 )
47endif()
48
49mark_as_advanced(
50 Catch2_INCLUDE_DIR
51)