aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2021-05-29 01:45:39 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2021-05-29 01:45:39 +0200
commit5ac85e69e34e44a3d487b9dd8418ecce3794ca2b (patch)
treebc84ee3e15cceefd496c34ae66db4e85f2ed4d0c /modules
parent07854bb9f0ac1ad5b5fad757395e04824c3fe9f3 (diff)
downloadextra-cmake-modules-5ac85e69e34e44a3d487b9dd8418ecce3794ca2b.tar.gz
extra-cmake-modules-5ac85e69e34e44a3d487b9dd8418ecce3794ca2b.tar.bz2
ecm_qt_declare_logging_category: catch alias targets before failing internally
target_sources() as used internally does not take alias targets.
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMQtDeclareLoggingCategory.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/ECMQtDeclareLoggingCategory.cmake b/modules/ECMQtDeclareLoggingCategory.cmake
index 7de5ae9b..c8ecd85b 100644
--- a/modules/ECMQtDeclareLoggingCategory.cmake
+++ b/modules/ECMQtDeclareLoggingCategory.cmake
@@ -35,7 +35,7 @@ to from C++ code using ``<identifier>``, and from the logging configuration usin
The generated source file will be added to the variable with the name
``<sources_var_name>``. If the given argument is a target though, instead both the
generated header file and the generated source file will be added to the target as
-private sources (since 5.80).
+private sources (since 5.80). The target must not be an alias.
If ``<filename>`` is not absolute, it will be taken relative to the current
binary directory.
@@ -230,6 +230,12 @@ function(ecm_qt_declare_logging_category sources_var)
if(ARG_EXPORT AND NOT ARG_DESCRIPTION)
message(FATAL_ERROR "Missing DESCRIPTION argument for ecm_qt_declare_logging_category.")
endif()
+ if (TARGET ${sources_var})
+ get_target_property(aliased_target ${sources_var} ALIASED_TARGET)
+ if(aliased_target)
+ message(FATAL_ERROR "Target argument passed to ecm_qt_declare_logging_category must not be an alias: ${sources_var}")
+ endif()
+ endif()
if (NOT IS_ABSOLUTE "${ARG_HEADER}")
set(ARG_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${ARG_HEADER}")