aboutsummaryrefslogtreecommitdiff
path: root/modules/ECMQtDeclareLoggingCategory.cmake
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2021-01-17 22:08:41 +0100
committerFriedrich W. H. Kossebau <kossebau@kde.org>2021-01-17 22:08:41 +0100
commit1704f7ab86253169615f19a9b10e2a832191b905 (patch)
tree6106ffc9e1a14ab4a9947134179d63a5e2bea0d1 /modules/ECMQtDeclareLoggingCategory.cmake
parent50c0f8b05bd623af927d29dc01e5c7e7fb04dd34 (diff)
downloadextra-cmake-modules-1704f7ab86253169615f19a9b10e2a832191b905.tar.gz
extra-cmake-modules-1704f7ab86253169615f19a9b10e2a832191b905.tar.bz2
ECMQtDeclareLoggingCategory: create .categories files in build, not configure
Ensures that the files * are re-created by build rule when accidentally deleted in the build dir * are not getting new timestamps on every cmake run, even when content has not changed
Diffstat (limited to 'modules/ECMQtDeclareLoggingCategory.cmake')
-rw-r--r--modules/ECMQtDeclareLoggingCategory.cmake18
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/ECMQtDeclareLoggingCategory.cmake b/modules/ECMQtDeclareLoggingCategory.cmake
index bc6f4710..752b5554 100644
--- a/modules/ECMQtDeclareLoggingCategory.cmake
+++ b/modules/ECMQtDeclareLoggingCategory.cmake
@@ -329,7 +329,7 @@ function(ecm_qt_install_logging_categories)
set(ARGS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_FILE}")
endif()
- file(WRITE ${ARGS_FILE}
+ set(_categories_content
"# KDebugSettings data file
# This file was generated by ecm_qt_install_logging_categories(). DO NOT EDIT!
@@ -350,15 +350,20 @@ function(ecm_qt_install_logging_categories)
# Format:
# logname<space>description(optional <space> DEFAULT_SEVERITY [DEFAULT_CATEGORY] as WARNING/DEBUG/INFO/CRITICAL) optional IDENTIFIER [...])
- file(APPEND ${ARGS_FILE} "${_category} ${_description} ${_default_severity}IDENTIFIER [${_identifier}]\n")
+ string(APPEND _categories_content "${_category} ${_description} ${_default_severity}IDENTIFIER [${_identifier}]\n")
endforeach()
+ file(GENERATE
+ OUTPUT ${ARGS_FILE}
+ CONTENT ${_categories_content}
+ )
+
set(_renamed_cats_file)
if (_renamed_categories)
get_filename_component(_dir ${ARGS_FILE} DIRECTORY)
get_filename_component(_base_name ${ARGS_FILE} NAME_WE)
set(_renamed_cats_file "${_dir}/${_base_name}.renamecategories")
- file(WRITE ${_renamed_cats_file}
+ set(_renamed_cats_content
"# KDebugSettings data file
# This file was generated by ecm_qt_install_logging_categories(). DO NOT EDIT!
@@ -373,10 +378,15 @@ function(ecm_qt_install_logging_categories)
foreach(_category_name IN LISTS _category_name_history)
# Format:
# oldlogname<space>newlogname
- file(APPEND ${_renamed_cats_file} "${_old_category_name} ${_category_name}\n")
+ string(APPEND _renamed_cats_content "${_old_category_name} ${_category_name}\n")
set(_old_category_name ${_category_name})
endforeach()
endforeach()
+
+ file(GENERATE
+ OUTPUT ${_renamed_cats_file}
+ CONTENT ${_renamed_cats_content}
+ )
endif()
# install files