From f76419291aa1e2d773329cceb089a5bd04d212ac Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Wed, 18 Oct 2023 18:14:10 +0900 Subject: [PATCH] Emit a clear error when a component is not found in a required package --- Config.cmake.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Config.cmake.in b/Config.cmake.in index 6f840d2a3..274c9fc80 100644 --- a/Config.cmake.in +++ b/Config.cmake.in @@ -142,7 +142,11 @@ foreach(component ${@PROJECT_NAME@_FIND_COMPONENTS}) if(@PROJECT_NAME@_${component}_FOUND) message(STATUS "@PROJECT_NAME@: ${component} found.") else() - message(STATUS "@PROJECT_NAME@: ${component} not found.") + if(@PROJECT_NAME@_FIND_REQUIRED_${component}) + message(FATAL_ERROR "@PROJECT_NAME@: ${component} not found.") + else() + message(STATUS "@PROJECT_NAME@: ${component} not found.") + endif() endif() endforeach() check_required_components("@PROJECT_NAME@")