From f7c1e8d57f84d0883a2a7683fd59ecc990a03de1 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 20 Mar 2016 11:52:27 +0100 Subject: ecm_qt_declare_logging_category: improve error message when using without including If one subdir in the project includes this file, all others can use the function but they don't see the value of the variable, which leads to a strange error CMake Error at ECM/modules/ECMQtDeclareLoggingCategory.cmake:114 (configure_file): configure_file input location is a directory but a file was expected. Happened in KIO, with kio/gui doing include+function call, and then adding function call in kio/widgets. REVIEW: 127432 --- modules/ECMQtDeclareLoggingCategory.cmake | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/ECMQtDeclareLoggingCategory.cmake') diff --git a/modules/ECMQtDeclareLoggingCategory.cmake b/modules/ECMQtDeclareLoggingCategory.cmake index b7f1ad39..c125949a 100644 --- a/modules/ECMQtDeclareLoggingCategory.cmake +++ b/modules/ECMQtDeclareLoggingCategory.cmake @@ -108,6 +108,10 @@ function(ecm_qt_declare_logging_category sources_var) string(REPLACE "::" "_" GUARD_NAME "${ARG_IDENTIFIER}_H") string(TOUPPER "${GUARD_NAME}" GUARD_NAME) + if (NOT _ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP) + message(FATAL_ERROR "You must include(ECMQtDeclareLoggingCategory) before using ecm_qt_declare_logging_category") + endif() + configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP}" "${cpp_filename}") configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_H}" "${ARG_HEADER}") -- cgit v1.2.1