summaryrefslogtreecommitdiffstats
path: root/cmake/QtToolHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-05-27 10:33:05 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-06-01 23:52:50 +0200
commit253d97cce625a55eb900f60540da0cec13782828 (patch)
tree0d28c89283e80062be5748827838c51eb0249204 /cmake/QtToolHelpers.cmake
parentf6b149fffbe650cb37e8602f46a0b6a2db32fb60 (diff)
Fix EXTRA_CMAKE_FILES behavior of qt_internal_add_tool
...and make it consistent with that of qt_internal_add_module. Make EXTRA_CMAKE_FILES a multi value keyword. Do not add include statements for every file in EXTRA_CMAKE_FILES. Add the EXTRA_CMAKE_INCLUDES argument to specify includes. This enables us to specify EXTRA_CMAKE_FILE that are not included. Change-Id: I1a3667473b94ee44363b554ab9e6c380e5c11389 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtToolHelpers.cmake')
-rw-r--r--cmake/QtToolHelpers.cmake33
1 files changed, 24 insertions, 9 deletions
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake
index 21687f5ec1..b923f1d393 100644
--- a/cmake/QtToolHelpers.cmake
+++ b/cmake/QtToolHelpers.cmake
@@ -19,6 +19,9 @@
# EXTRA_CMAKE_FILES
# List of additional CMake files that will be installed alongside the tool's exported CMake
# files.
+# EXTRA_CMAKE_INCLUDES
+# List of files that will be included in the Qt6${module}Tools.cmake file.
+# Also see TOOLS_TARGET.
# INSTALL_DIR
# Takes a path, relative to the install prefix, like INSTALL_LIBEXECDIR.
# If this argument is omitted, the default is INSTALL_BINDIR.
@@ -29,11 +32,17 @@
function(qt_internal_add_tool target_name)
qt_tool_target_to_name(name ${target_name})
set(option_keywords BOOTSTRAP NO_INSTALL USER_FACING INSTALL_VERSIONED_LINK)
- set(one_value_keywords TOOLS_TARGET EXTRA_CMAKE_FILES INSTALL_DIR
- ${__default_target_info_args})
+ set(one_value_keywords
+ TOOLS_TARGET
+ INSTALL_DIR
+ ${__default_target_info_args})
+ set(multi_value_keywords
+ EXTRA_CMAKE_FILES
+ EXTRA_CMAKE_INCLUDES
+ ${__default_private_args})
qt_parse_all_arguments(arg "qt_internal_add_tool" "${option_keywords}"
"${one_value_keywords}"
- "${__default_private_args}" ${ARGN})
+ "${multi_value_keywords}" ${ARGN})
# Handle case when a tool does not belong to a module and it can't be built either (like
# during a cross-compile).
@@ -184,6 +193,12 @@ function(qt_internal_add_tool target_name)
)
endif()
+ if(arg_EXTRA_CMAKE_INCLUDES)
+ set_target_properties(${target_name} PROPERTIES
+ EXTRA_CMAKE_INCLUDES "${arg_EXTRA_CMAKE_INCLUDES}"
+ )
+ endif()
+
if(arg_USER_FACING)
set_property(GLOBAL APPEND PROPERTY QT_USER_FACING_TOOL_TARGETS ${target_name})
endif()
@@ -272,6 +287,7 @@ function(qt_export_tools module_name)
# Additional cmake files to install
set(extra_cmake_files "")
+ set(extra_cmake_includes "")
foreach(tool_name ${QT_KNOWN_MODULE_${module_name}_TOOLS})
# Specific tools can have package dependencies.
@@ -289,6 +305,11 @@ function(qt_export_tools module_name)
endforeach()
endif()
+ get_target_property(_extra_cmake_includes "${tool_name}" EXTRA_CMAKE_INCLUDES)
+ if(_extra_cmake_includes)
+ list(APPEND extra_cmake_includes "${_extra_cmake_includes}")
+ endif()
+
if (CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
string(REGEX REPLACE "_native$" "" tool_name ${tool_name})
endif()
@@ -307,12 +328,6 @@ endif()
string(APPEND extra_cmake_statements
"set(${QT_CMAKE_EXPORT_NAMESPACE}${module_name}Tools_TARGETS \"${tool_targets}\")")
- set(extra_cmake_includes "")
- foreach(extra_cmake_file ${extra_cmake_files})
- get_filename_component(extra_cmake_include "${extra_cmake_file}" NAME)
- list(APPEND extra_cmake_includes "${extra_cmake_include}")
- endforeach()
-
# Extract package dependencies that were determined in QtPostProcess, but only if ${module_name}
# is an actual target.
# module_name can be a non-existent target, if the tool doesn't have an existing associated