summaryrefslogtreecommitdiffstats
path: root/cmake/QtExecutableHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-05 14:21:25 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-03-11 13:47:57 +0100
commitcc537d927b23a34296767fec8d3885a95f714255 (patch)
tree518ac4f13ab6fe3508f0ad2e10eea3a93887a7cd /cmake/QtExecutableHelpers.cmake
parent20bd9fad1cf6d41c773056949e334c3ab75e8b1c (diff)
CMake: Fix syncqt IMPORTED_LOCATION path for multi-config builds
When building examples as ExternalProjects as part of a multi-config qtbase build, syncqt can not be located with the following error: CMake Error at Qt6CoreToolsAdditionalTargetInfo.cmake:10 (message): Unable to add configure time executable Qt6::syncqt qtbase/libexec/syncqt doesn't exist Call Stack (most recent call first): qtbase/lib/cmake/Qt6CoreTools/Qt6CoreToolsConfig.cmake:44 (include) qtbase/cmake/QtPublicDependencyHelpers.cmake:65 (find_package) qtbase/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:34 (_qt_internal_find_tool_dependencies) qtbase/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:42 (include) qtbase/lib/cmake/Qt6/Qt6Config.cmake:165 (find_package) CMakeLists.txt:13 (find_package) The Qt6CoreToolsAdditionalTargetInfo.cmake file is used both for install(EXPORT) Config files as well as export(EXPORT) Config files, and in the latter case, the path that syncqt is looked up in is not correct because syncqt is not yet installed. In addition to checking whether syncqt exists in the install path, also check if it exists in the build dir. Ideally the additional path would be stored in a separate file that is not installed, but the current code infrastructure does not provide such a feature. Because we store a relative path instead of an absolute path, the build path does not leak, so the situation is bearable. Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I16ad5c280751e050bc9b039ebd38ec9a66a6554c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake/QtExecutableHelpers.cmake')
-rw-r--r--cmake/QtExecutableHelpers.cmake10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake
index bcb5a3e514d..fb96ca4db20 100644
--- a/cmake/QtExecutableHelpers.cmake
+++ b/cmake/QtExecutableHelpers.cmake
@@ -385,9 +385,15 @@ function(qt_internal_add_configure_time_executable target)
if(arg_INSTALL_DIRECTORY)
set(install_dir "${arg_INSTALL_DIRECTORY}")
endif()
+
+ set(output_directory_relative "${install_dir}")
set(output_directory "${QT_BUILD_DIR}/${install_dir}")
+
+ set(target_binary_path_relative
+ "${output_directory_relative}/${configuration_path}${target_binary}")
set(target_binary_path
"${output_directory}/${configuration_path}${target_binary}")
+
get_filename_component(target_binary_path "${target_binary_path}" ABSOLUTE)
if(NOT DEFINED arg_SOURCES)
@@ -516,7 +522,9 @@ function(qt_internal_add_configure_time_executable target)
add_executable(${QT_CMAKE_EXPORT_NAMESPACE}::${target} ALIAS ${target})
set_target_properties(${target} PROPERTIES
_qt_internal_configure_time_target TRUE
- IMPORTED_LOCATION "${target_binary_path}")
+ _qt_internal_configure_time_target_build_location "${target_binary_path_relative}"
+ IMPORTED_LOCATION "${target_binary_path}"
+ )
if(NOT arg_NO_INSTALL)
set_target_properties(${target} PROPERTIES