-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: simplify detection of Catch v3 for tests
- Loading branch information
Showing
1 changed file
with
5 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
cmake_minimum_required (VERSION 3.8) | ||
|
||
# MSYS2 / MinGW uses Catch 3.x. | ||
if (MINGW) | ||
include (CheckIncludeFileCXX) | ||
check_include_file_cxx (catch2/catch_test_macros.hpp HAS_CATCH_V3_HEADER) | ||
check_include_file_cxx (catch2/catch.hpp HAS_CATCH_V2_HEADER) | ||
|
||
if (HAS_CATCH_V3_HEADER AND NOT HAS_CATCH_V2_HEADER) | ||
set(HAS_CATCH_V3 ON) | ||
else () | ||
set(HAS_CATCH_V3 OFF) | ||
endif () | ||
|
||
# Some newer distros like Fedora 38+ or Ubuntu 24.04+ also use Catch 3.x. | ||
if (UNIX AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.22.0") | ||
cmake_host_system_information(RESULT DIST_NAME QUERY DISTRIB_NAME) | ||
cmake_host_system_information(RESULT DIST_VERSION_ID QUERY DISTRIB_VERSION_ID) | ||
|
||
if (DIST_NAME STREQUAL "Fedora Linux" AND DIST_VERSION_ID VERSION_GREATER_EQUAL "38") | ||
# Fedora 38 or later detected, set flag for Catch 3.x. | ||
set(HAS_CATCH_V3 ON) | ||
endif () | ||
if (DIST_NAME STREQUAL "Ubuntu" AND DIST_VERSION_ID VERSION_GREATER_EQUAL "24.04") | ||
# Ubuntu 24.04 or later detected, set flag for Catch 3.x. | ||
set(HAS_CATCH_V3 ON) | ||
endif () | ||
endif() | ||
|
||
add_subdirectory (webp-viewer-tests) |