From 787987ef863961cbf8017f86771a2438f6500ad5 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 17 Apr 2023 15:55:17 +0200 Subject: [PATCH] Handle REQUIRED in our CMake "find" modules These are expected to abort if they fail to find the relevant software and "REQUIRED" is specified. --- cmake/Modules/FindFfmpeg.cmake | 5 +++++ cmake/Modules/FindGmp.cmake | 4 ++++ cmake/Modules/FindNettle.cmake | 4 ++++ cmake/Modules/FindPixman.cmake | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/cmake/Modules/FindFfmpeg.cmake b/cmake/Modules/FindFfmpeg.cmake index cf09fa4a..1a082449 100644 --- a/cmake/Modules/FindFfmpeg.cmake +++ b/cmake/Modules/FindFfmpeg.cmake @@ -15,3 +15,8 @@ else() find_library(SWSCALE_LIBRARIES NAMES swscale) find_package_handle_standard_args(SWSCALE DEFAULT_MSG SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIRS) endif() + +if(Ffmpeg_FIND_REQUIRED AND + (NOT AVCODEC_FOUND OR NOT AVUTIL_FOUND OR NOT SWSCALE_FOUND)) + message(FATAL_ERROR "Could not find FFMPEG") +endif() diff --git a/cmake/Modules/FindGmp.cmake b/cmake/Modules/FindGmp.cmake index d0ccd3cd..8711d68e 100644 --- a/cmake/Modules/FindGmp.cmake +++ b/cmake/Modules/FindGmp.cmake @@ -11,3 +11,7 @@ if(NOT GMP_FOUND) find_library(GMP_LIBRARIES NAMES gmp) find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARIES GMP_INCLUDE_DIRS) endif() + +if(Gmp_FIND_REQUIRED AND NOT GMP_FOUND) + message(FATAL_ERROR "Could not find GMP") +endif() diff --git a/cmake/Modules/FindNettle.cmake b/cmake/Modules/FindNettle.cmake index e2283c49..f5acf6ac 100644 --- a/cmake/Modules/FindNettle.cmake +++ b/cmake/Modules/FindNettle.cmake @@ -15,3 +15,7 @@ endif() if (NOT HOGWEED_FOUND OR NOT GMP_FOUND) set(NETTLE_FOUND 0) endif() + +if(Nettle_FIND_REQUIRED AND NOT NETTLE_FOUND) + message(FATAL_ERROR "Could not find Nettle") +endif() diff --git a/cmake/Modules/FindPixman.cmake b/cmake/Modules/FindPixman.cmake index 04fe481f..f024b71a 100644 --- a/cmake/Modules/FindPixman.cmake +++ b/cmake/Modules/FindPixman.cmake @@ -7,3 +7,7 @@ else() find_library(PIXMAN_LIBRARIES NAMES pixman-1) find_package_handle_standard_args(PIXMAN DEFAULT_MSG PIXMAN_LIBRARIES PIXMAN_INCLUDE_DIRS) endif() + +if(Pixman_FIND_REQUIRED AND NOT PIXMAN_FOUND) + message(FATAL_ERROR "Could not find Pixman") +endif() -- 2.39.5