Improve handling Svg support
This commit is contained in:
parent
58d762b7ee
commit
b35e5311a9
|
@ -113,7 +113,7 @@ set(META_APP_AUTHOR "Martchus")
|
|||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
set(META_APP_DESCRIPTION "Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
||||
set(META_VERSION_MAJOR 5)
|
||||
set(META_VERSION_MINOR 0)
|
||||
set(META_VERSION_MINOR 1)
|
||||
set(META_VERSION_PATCH 0)
|
||||
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
||||
|
||||
|
|
|
@ -8,11 +8,8 @@
|
|||
set(QT_REPOS base ${ADDITIONAL_QT_REPOS})
|
||||
set(QT_MODULES Core ${ADDITIONAL_QT_MODULES})
|
||||
set(KF_MODULES ${ADDITIONAL_KF_MODULES})
|
||||
list(REMOVE_DUPLICATES QT_REPOS)
|
||||
list(REMOVE_DUPLICATES QT_MODULES)
|
||||
if(KF_MODULES)
|
||||
list(REMOVE_DUPLICATES KF_MODULES)
|
||||
endif()
|
||||
|
||||
include(QtLinkage)
|
||||
|
||||
# check whether D-Bus interfaces need to be processed
|
||||
if(DBUS_FILES)
|
||||
|
@ -21,7 +18,19 @@ if(DBUS_FILES)
|
|||
list(APPEND QT_MODULES DBus)
|
||||
endif()
|
||||
|
||||
include(QtLinkage)
|
||||
if(SVG_SUPPORT OR ((USE_STATIC_QT_BUILD AND (WIDGETS_GUI OR QUICK_GUI)) AND SVG_ICON_SUPPORT))
|
||||
list(APPEND QT_MODULES Svg)
|
||||
list(APPEND QT_REPOS svg)
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES QT_REPOS)
|
||||
list(REMOVE_DUPLICATES QT_MODULES)
|
||||
if(KF_MODULES)
|
||||
list(REMOVE_DUPLICATES KF_MODULES)
|
||||
endif()
|
||||
|
||||
message(STATUS "Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against the following Qt 5 modules: ${QT_MODULES}")
|
||||
message(STATUS "Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against the following KDE 5 modules: ${KF_MODULES}")
|
||||
|
||||
# actually find the required Qt/KF modules
|
||||
foreach(QT_MODULE ${QT_MODULES})
|
||||
|
@ -36,17 +45,14 @@ foreach(KF_MODULE ${KF_MODULES})
|
|||
endforeach()
|
||||
|
||||
# include plugins statically
|
||||
if(USE_STATIC_QT_BUILD)
|
||||
if(WIDGETS_GUI OR QUICK_GUI)
|
||||
if(WIN32)
|
||||
list(APPEND LIBRARIES Qt5::QWindowsIntegrationPlugin)
|
||||
list(APPEND STATIC_LIBRARIES Qt5::QWindowsIntegrationPlugin)
|
||||
endif()
|
||||
if(SVG_SUPPORT)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
list(APPEND LIBRARIES Qt5::Svg Qt5::QSvgPlugin)
|
||||
list(APPEND STATIC_LIBRARIES Qt5::Svg Qt5::QSvgPlugin)
|
||||
endif()
|
||||
if(USE_STATIC_QT_BUILD AND (WIDGETS_GUI OR QUICK_GUI))
|
||||
if(WIN32)
|
||||
list(APPEND LIBRARIES Qt5::QWindowsIntegrationPlugin)
|
||||
list(APPEND STATIC_LIBRARIES Qt5::QWindowsIntegrationPlugin)
|
||||
endif()
|
||||
if(SVG_ICON_SUPPORT)
|
||||
list(APPEND LIBRARIES Qt5::QSvgPlugin)
|
||||
list(APPEND STATIC_LIBRARIES Qt5::QSvgPlugin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
||||
|
||||
# after including this module, AppConfig must be included
|
||||
|
||||
# enable Qt Widgets GUI
|
||||
|
@ -51,5 +53,10 @@ if(WIDGETS_GUI OR QUICK_GUI)
|
|||
endif()
|
||||
|
||||
# add option for enabling/disabling static Qt plugins
|
||||
option(SVG_SUPPORT "enables/disables svg support for Qt GUI (only affects static builds where QSvgPlugin will be built-in if enabled)" ON)
|
||||
if("Svg" IN_LIST ADDITIONAL_QT_MODULES)
|
||||
# Qt Svg module is not optional
|
||||
set(SVG_SUPPORT ON)
|
||||
else()
|
||||
option(SVG_SUPPORT "enables/disables svg support for Qt GUI" OFF)
|
||||
endif()
|
||||
option(SVG_ICON_SUPPORT "enables/disables svg icon support for Qt GUI (only affects static builds where QSvgPlugin will be built-in if enabled)" ON)
|
||||
|
|
Loading…
Reference in New Issue