summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-07-22 16:54:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-25 08:17:40 +0000
commite9457483fe3ab5fd243da3905ac87d125cc9b42b (patch)
tree3c7b7ec6cdf61b42eda7f772a33cb152cd686d66
parenta9fa3a47e9b4ea5167af5f4a00b3eaaef8133b07 (diff)
CMake: Fix build with system litehtml and gumbo
We can't set compiler flags on already built targets. Only set them conditionally on if the targets are available in the assistant subdirectory scope. They will only be available there when litehtml is built as part of qttools itself. Fixes: QTBUG-105130 Change-Id: Ie56ecf2b453d03147dde95aa04434a988febd4da Reviewed-by: Moody Liu <mooodyhunter@outlook.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit efa979b053d0084632bdff6b1d0d9860fd881ced) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/assistant/CMakeLists.txt14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/assistant/CMakeLists.txt b/src/assistant/CMakeLists.txt
index e9b2146ef..868eefdad 100644
--- a/src/assistant/CMakeLists.txt
+++ b/src/assistant/CMakeLists.txt
@@ -31,10 +31,18 @@ endif()
add_subdirectory(qlitehtml/src EXCLUDE_FROM_ALL)
if(TARGET qlitehtml)
qt_autogen_tools_initial_setup(qlitehtml)
- qt_internal_set_exceptions_flags(litehtml OFF)
- qt_disable_warnings(litehtml)
+ # The litehtml and gumbo targets will not be available here if they are not built by Qt
+ # but found in the system, because they are imported only to the subdirectory scope
+ # where find_package was called. But that's fine, we wouldn't be able to set compiler flags
+ # on them anyway.
+ if(TARGET litehtml)
+ qt_internal_set_exceptions_flags(litehtml OFF)
+ qt_disable_warnings(litehtml)
+ endif()
+ if(TARGET gumbo)
+ qt_disable_warnings(gumbo)
+ endif()
qt_disable_warnings(qlitehtml)
- qt_disable_warnings(gumbo)
qt_handle_multi_config_output_dirs(qlitehtml)
set_target_properties(qlitehtml PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"