summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-12-05 13:54:07 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-12-06 11:11:16 +0000
commit04d895681adab24829be44c392534bcbe9d6c106 (patch)
treeeea1c9686875e8b4189112f256468738e6a21fdc /cmake/QtBuild.cmake
parent05ba991d39a84bb4dfea27aa423c329449d23d46 (diff)
CMake: Fix creation of versionless targets for tools
We can't use qt_internal_export_modern_cmake_config_targets_file for executables like tools, because it's not possible to use INTERFACE_LINK_LIBRARIES with executables like you can with libraries. We also can't create aliases to non-global imported targets. Instead create new imported executable targets, fish out the imported location, and assign it to the versionless targets. Task-number: QTBUG-74137 Task-number: QTBUG-80477 Task-number: QTBUG-75984 Change-Id: I6a3c9c67ef4699c72a6c9a627c63158dfd6557f8 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake20
1 files changed, 15 insertions, 5 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 0840a9bd78..480093d043 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -1742,6 +1742,7 @@ function(qt_export_tools module_name)
# Also assemble a list of tool targets to expose in the config file for informational purposes.
set(extra_cmake_statements "")
set(tool_targets "")
+ set(tool_targets_non_prefixed "")
# List of package dependencies that need be find_package'd when using the Tools package.
set(package_deps "")
@@ -1763,6 +1764,7 @@ if (NOT QT_NO_CREATE_TARGETS)
endif()
")
list(APPEND tool_targets "${QT_CMAKE_EXPORT_NAMESPACE}::${tool_name}")
+ list(APPEND tool_targets_non_prefixed "${tool_name}")
endforeach()
string(APPEND extra_cmake_statements
@@ -1816,11 +1818,19 @@ endif()
NAMESPACE "${QT_CMAKE_EXPORT_NAMESPACE}::"
DESTINATION "${config_install_dir}")
- # Temporarily disable creation of versionless targets for tools,
- # because it breaks qtdeclarative build.
- #qt_internal_export_modern_cmake_config_targets_file(TARGETS ${QT_KNOWN_MODULE_${module_name}_TOOLS}
- # EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
- # CONFIG_INSTALL_DIR ${config_install_dir})
+
+ # Create versionless targets file.
+ configure_file(
+ "${QT_CMAKE_DIR}/QtModuleToolsVersionlessTargets.cmake.in"
+ "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}VersionlessTargets.cmake"
+ @ONLY
+ )
+
+ qt_install(FILES
+ "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}VersionlessTargets.cmake"
+ DESTINATION "${config_install_dir}"
+ COMPONENT Devel
+ )
endfunction()
# This function records a dependency between ${target_name} and ${dep_package_name}.