aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-07 12:14:09 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-11 16:20:55 +0200
commit0d517b553bb8e94262d54439d3e16086896c1b7d (patch)
tree4ef7ad68a36208de0f313211b1981c79d865daa3 /CMakeLists.txt
parentcdf85cf884435a4fc559c98bec192552e90e105a (diff)
CMake: Make qtdeclarative depend only on host qtshadertools package
When building QtQuick, it only needs qsb and the qt_internal_add_shaders CMake API from qtshadertools, it doesn't need the ShaderTools library. Look for the ShaderToolsTools package which is created by the host qtshadertools build. This will allow building target qtdeclarative without having to build target qtshadertools first. For the ShaderToolsTools package to be found when cross-compiling, we need to add the QT_HOST_PATH to both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH temporarily. Amends 4fb84137f1c0a49d64b8bef66fef8a4384cc2a68 Fixes: QTBUG-92050 Change-Id: Ided9189e23b2c60bf7d9f189d94f4bf9fb142218 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6342f42322..f62ccbd54e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,25 @@ set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE)
# special case end
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) # special case
-find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui Network Widgets OpenGL OpenGLWidgets Sql Concurrent Test ShaderTools) # special case
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui Network Widgets OpenGL OpenGLWidgets Sql Concurrent Test)
+
+# Set up QT_HOST_PATH as an extra root path to look for the ShaderToolsTools package
+# when cross-compiling.
+if(NOT "${QT_HOST_PATH}" STREQUAL "")
+ set(_qt_backup_qtdeclarative_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
+ set(_qt_backup_qtdeclarative_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
+ list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH_CMAKE_DIR}")
+ list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
+endif()
+
+# This can't use the find_package(Qt6 COMPONENTS) signature, because Qt6Config uses NO_DEFAULT and
+# won't look at the prepend extra find root paths.
+find_package(Qt6ShaderToolsTools ${PROJECT_VERSION} QUIET CONFIG)
+
+if(NOT "${QT_HOST_PATH}" STREQUAL "")
+ set(CMAKE_PREFIX_PATH ${_qt_backup_qtdeclarative_CMAKE_PREFIX_PATH})
+ set(CMAKE_FIND_ROOT_PATH ${_qt_backup_qtdeclarative_CMAKE_FIND_ROOT_PATH})
+endif()
# special case begin
# export QT6_ADD_QML_MODULE to this project