Merge pull request #356 from Jihadist/feature/cmake-uitools-optional

CMake: make Qt::UiTools optional
This commit is contained in:
Alexander Arin 2021-11-10 19:18:49 +03:00 committed by GitHub
commit 618f765015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,11 +10,16 @@ option(LIMEREPORT_STATIC "Build LimeReport as static library" OFF)
find_package(
QT NAMES Qt6 Qt5
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport UiTools
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport REQUIRED
)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport UiTools
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport REQUIRED
)
find_package(
Qt${QT_VERSION_MAJOR}
COMPONENTS UiTools
)
# Old Qt does not provide QT_VERSION_MAJOR
if (NOT QT_VERSION_MAJOR)
@ -341,6 +346,12 @@ endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC -DCMAKE_CONFIG)
if(Qt${QT_VERSION_MAJOR}UiTools_FOUND)
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_UI_LOADER)
target_link_libraries( ${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::UiTools)
endif()
target_link_libraries( ${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
@ -348,14 +359,15 @@ target_link_libraries( ${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Xml
Qt${QT_VERSION_MAJOR}::Sql
Qt${QT_VERSION_MAJOR}::PrintSupport
Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::UiTools)
Qt${QT_VERSION_MAJOR}::Svg)
if(ENABLE_ZINT)
target_link_libraries( ${PROJECT_NAME} PRIVATE QZint)
endif(ENABLE_ZINT)
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_QT5 -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -DHAVE_UI_LOADER -D_CRT_SECURE_NO_WARNINGS)
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS)
target_include_directories( ${PROJECT_NAME} PRIVATE
limereport/
limereport/base