You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When configuring QtUsb included in a cmake project using add_subdirectory, configuration fails with the following error message:
CMake Error at /usr/lib/cmake/Qt6/QtPublicTargetHelpers.cmake:307 (set_property):
Attempt to promote imported target "Threads::Threads" to global scope (by
setting IMPORTED_GLOBAL) which is not built in this directory.
Call Stack (most recent call first):
/usr/lib/cmake/Qt6/QtPublicTargetHelpers.cmake:348 (__qt_internal_promote_target_to_global)
/usr/lib/cmake/Qt6/QtPublicTargetHelpers.cmake:332 (_qt_internal_promote_3rd_party_target_to_global)
/usr/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:59 (_qt_internal_promote_3rd_party_provided_target_and_3rd_party_deps_to_global)
/usr/lib/cmake/Qt6/Qt6Dependencies.cmake:34 (_qt_internal_find_third_party_dependencies)
/usr/lib/cmake/Qt6/Qt6Config.cmake:146 (include)
lib/qtusb/CMakeLists.txt:13 (find_package)
I got more information. It seems that QtUsb manages to fool Qt into thinking that it is a part of the Qt repository.
In my /usr/lib/cmake/Qt6/QtPublicTargetHelpers.cmake I found the following snippet:
function(_qt_internal_promote_3rd_party_provided_target_and_3rd_party_deps_to_global target)
# Return early if building a user project, and not Qt.# QT_BUILDING_QT is set when building a qt repo, but we also check for QT_REPO_MODULE_VERSION,# which is set in .cmake.conf, because _qt_internal_find_third_party_dependencies is called# before QT_BUILDING_QT is set. if(NOT (QT_BUILDING_QT OR QT_REPO_MODULE_VERSION))
return()
endif()
It seems that the variable QT_REPO_MODULE_VERSION is set to 6.4.2 from here and here, which prevents return() from being invoked in the referenced clause above.
I would recommend a patch along the following lines:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31bb763..3a5c1dc 100644
--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -2,7 +2,9 @@
cmake_minimum_required(VERSION 3.16)
-include(.cmake.conf)+if(QTUSB_MODULE)+ include(.cmake.conf)+endif()
project(QtUsb
VERSION 6.4.0 # FIXME: this needs to match host's Qt version
DESCRIPTION "A cross-platform USB Module for Qt."
Describe the bug
When configuring QtUsb included in a cmake project using
add_subdirectory
, configuration fails with the following error message:Platform:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The cmake project should configure without any error messages.
Additional context
Did not find any
The text was updated successfully, but these errors were encountered: