From 224302500d73023ece5b13e25ed505cfd3f59e73 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Wed, 17 May 2023 09:20:37 +0800 Subject: [PATCH] cmake: quick: fix build with version below 6.3 Fixes: #215 --- src/quick/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/quick/CMakeLists.txt b/src/quick/CMakeLists.txt index 144b723..595a0a3 100644 --- a/src/quick/CMakeLists.txt +++ b/src/quick/CMakeLists.txt @@ -156,7 +156,12 @@ if(DEFINED FRAMELESSHELPER_IMPORT_DIR) set(__import_base_dir "${FRAMELESSHELPER_IMPORT_DIR}") endif() -if(QT_VERSION VERSION_GREATER_EQUAL "6.2") +# qt_add_qml_module() was introduced in Qt 6.2 but qt_query_qml_module() +# was introduced in 6.3, to simplify the CMake code, I decide to limit the +# version check to 6.3, otherwise we'll need a lot of code to query and +# calculate the generated files, which will also break Ninja Multi-Config +# builds. +if(QT_VERSION VERSION_GREATER_EQUAL "6.3") qt_add_qml_module(${SUB_PROJ_NAME} URI "org.wangwenx190.${PROJECT_NAME}" VERSION "1.0" @@ -171,6 +176,11 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2") ) if(__qml_targets) foreach(__target ${__qml_targets}) + # We have some resources bundled into the library, + # however, for static builds, the object files will + # not be packed into our final static library file, + # and thus it causes linker errors for our users, + # so we need this hack here. if(FRAMELESSHELPER_BUILD_STATIC) target_sources(${SUB_PROJ_NAME} PRIVATE $