From d7bd271a49945289cf2684802daaca9d3c47a3cf Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 23 May 2023 16:18:36 -0500 Subject: [PATCH] CMake: change a warning into an error For the time being we are not prepared to encounter an undefined target at this point of the configure process. Thus simply emit a fatal error instead of a warning. --- cmake/macros/macro_copy_target_properties.cmake | 8 +++++--- cmake/macros/macro_define_interface_target.cmake | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/macros/macro_copy_target_properties.cmake b/cmake/macros/macro_copy_target_properties.cmake index c9b62b21b2..6533dfeef1 100644 --- a/cmake/macros/macro_copy_target_properties.cmake +++ b/cmake/macros/macro_copy_target_properties.cmake @@ -79,11 +79,13 @@ function(copy_target_properties _destination_target) if(TARGET ${_lib}) list(APPEND _source_targets ${_lib}) else() - # Warn loudly if we encounter an undefined target: + # + # Complain loudly if we encounter an undefined target: + # if("${_lib}" MATCHES "::") - message(WARNING + message(FATAL_ERROR "Undefined imported target name »${_lib}« present in interface " - "of target »${_entry}«" + "of target »${_entry}«." ) endif() list(APPEND _libraries ${_lib}) diff --git a/cmake/macros/macro_define_interface_target.cmake b/cmake/macros/macro_define_interface_target.cmake index a3dff00f31..0bc0591dbf 100644 --- a/cmake/macros/macro_define_interface_target.cmake +++ b/cmake/macros/macro_define_interface_target.cmake @@ -93,9 +93,11 @@ function(define_interface_target _feature) ) if(NOT "${_libraries}" STREQUAL "") foreach(_lib ${_libraries}) - # Warn loudly if we encounter an undefined target: + # + # Complain loudly if we encounter an undefined target: + # if("${_lib}" MATCHES "::") - message(WARNING + message(FATAL_ERROR "Undefined imported target name »${_lib}« present when defining " "interface target »${_interface_target}«" ) -- 2.39.5