2020-01-10 18:01:27 +01:00
|
|
|
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
|
2015-12-05 22:50:38 +01:00
|
|
|
|
2017-01-07 16:46:53 +01:00
|
|
|
# meta data
|
|
|
|
set(META_PROJECT_NAME qtutilities)
|
|
|
|
set(META_PROJECT_VARNAME QT_UTILITIES)
|
|
|
|
set(META_APP_NAME "Qt Utilities")
|
|
|
|
set(META_APP_AUTHOR "Martchus")
|
|
|
|
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
2019-02-06 17:32:10 +01:00
|
|
|
set(META_APP_DESCRIPTION
|
|
|
|
"Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models")
|
2019-04-04 19:13:30 +02:00
|
|
|
set(META_VERSION_MAJOR 6)
|
|
|
|
set(META_VERSION_MINOR 0)
|
2020-01-10 18:01:27 +01:00
|
|
|
set(META_VERSION_PATCH 4)
|
2017-01-07 16:46:53 +01:00
|
|
|
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
|
|
|
|
2019-07-20 16:32:35 +02:00
|
|
|
project(${META_PROJECT_NAME})
|
|
|
|
|
2015-12-08 08:36:36 +01:00
|
|
|
# add project files
|
|
|
|
set(HEADER_FILES
|
2016-03-03 01:43:48 +01:00
|
|
|
misc/xmlparsermacros.h
|
2016-03-06 17:12:50 +01:00
|
|
|
misc/undefxmlparsermacros.h
|
2016-03-10 22:15:16 +01:00
|
|
|
misc/trylocker.h
|
|
|
|
misc/adoptlocker.h
|
2016-04-16 18:32:56 +02:00
|
|
|
misc/dialogutils.h
|
|
|
|
misc/desktoputils.h
|
2016-12-19 23:38:32 +01:00
|
|
|
misc/conversion.h
|
2015-12-08 08:36:36 +01:00
|
|
|
models/checklistmodel.h
|
|
|
|
resources/qtconfigarguments.h
|
|
|
|
resources/resources.h
|
2019-02-06 17:32:10 +01:00
|
|
|
resources/importplugin.h)
|
2019-11-30 17:58:56 +01:00
|
|
|
set(SRC_FILES misc/dialogutils.cpp misc/desktoputils.cpp models/checklistmodel.cpp resources/qtconfigarguments.cpp
|
|
|
|
resources/resources.cpp)
|
2019-02-06 17:32:10 +01:00
|
|
|
set(RES_FILES resources/qtutilsicons.qrc)
|
2016-04-16 00:50:31 +02:00
|
|
|
|
2016-04-09 02:33:09 +02:00
|
|
|
set(WIDGETS_HEADER_FILES
|
|
|
|
aboutdialog/aboutdialog.h
|
|
|
|
enterpassworddialog/enterpassworddialog.h
|
2015-12-08 08:36:36 +01:00
|
|
|
settingsdialog/optioncategory.h
|
|
|
|
settingsdialog/optioncategoryfiltermodel.h
|
|
|
|
settingsdialog/optioncategorymodel.h
|
|
|
|
settingsdialog/optionpage.h
|
|
|
|
settingsdialog/settingsdialog.h
|
2016-04-04 14:49:40 +02:00
|
|
|
settingsdialog/qtsettings.h
|
2015-12-08 08:36:36 +01:00
|
|
|
widgets/buttonoverlay.h
|
|
|
|
widgets/clearcombobox.h
|
|
|
|
widgets/clearlineedit.h
|
|
|
|
widgets/clearplaintextedit.h
|
|
|
|
widgets/clearspinbox.h
|
|
|
|
widgets/iconbutton.h
|
2016-04-09 02:33:09 +02:00
|
|
|
widgets/pathselection.h
|
2016-04-04 14:49:40 +02:00
|
|
|
paletteeditor/paletteeditor.h
|
|
|
|
paletteeditor/colorbutton.h
|
2019-02-06 17:32:10 +01:00
|
|
|
misc/recentmenumanager.h)
|
2016-04-09 02:33:09 +02:00
|
|
|
set(WIDGETS_SRC_FILES
|
2015-12-08 08:36:36 +01:00
|
|
|
aboutdialog/aboutdialog.cpp
|
|
|
|
enterpassworddialog/enterpassworddialog.cpp
|
|
|
|
settingsdialog/optioncategory.cpp
|
|
|
|
settingsdialog/optioncategoryfiltermodel.cpp
|
|
|
|
settingsdialog/optioncategorymodel.cpp
|
|
|
|
settingsdialog/optionpage.cpp
|
|
|
|
settingsdialog/settingsdialog.cpp
|
2016-04-04 14:49:40 +02:00
|
|
|
settingsdialog/qtsettings.cpp
|
2015-12-08 08:36:36 +01:00
|
|
|
widgets/buttonoverlay.cpp
|
|
|
|
widgets/clearcombobox.cpp
|
|
|
|
widgets/clearlineedit.cpp
|
|
|
|
widgets/clearplaintextedit.cpp
|
|
|
|
widgets/clearspinbox.cpp
|
|
|
|
widgets/iconbutton.cpp
|
2016-04-09 02:33:09 +02:00
|
|
|
widgets/pathselection.cpp
|
2016-04-04 14:49:40 +02:00
|
|
|
paletteeditor/paletteeditor.cpp
|
|
|
|
paletteeditor/colorbutton.cpp
|
2019-02-06 17:32:10 +01:00
|
|
|
misc/recentmenumanager.cpp)
|
2016-01-25 18:59:44 +01:00
|
|
|
set(WIDGETS_UI_FILES
|
|
|
|
aboutdialog/aboutdialog.ui
|
|
|
|
enterpassworddialog/enterpassworddialog.ui
|
|
|
|
settingsdialog/settingsdialog.ui
|
2016-04-04 14:49:40 +02:00
|
|
|
settingsdialog/qtappearanceoptionpage.ui
|
|
|
|
settingsdialog/qtlanguageoptionpage.ui
|
2016-04-09 02:33:09 +02:00
|
|
|
settingsdialog/qtenvoptionpage.ui
|
2019-02-06 17:32:10 +01:00
|
|
|
paletteeditor/paletteeditor.ui)
|
2015-12-08 08:36:36 +01:00
|
|
|
|
2016-04-16 00:50:31 +02:00
|
|
|
set(CMAKE_MODULE_FILES
|
2019-11-30 17:58:56 +01:00
|
|
|
cmake/modules/AndroidApk.cmake cmake/modules/QtConfig.cmake cmake/modules/QtGuiConfig.cmake
|
|
|
|
cmake/modules/QtLinkage.cmake cmake/modules/QtWebViewProviderConfig.cmake cmake/modules/QtJsProviderConfig.cmake)
|
|
|
|
set(CMAKE_TEMPLATE_FILES cmake/templates/qtconfig.h.in cmake/templates/webviewdefs.h.in cmake/templates/webviewincludes.h.in
|
|
|
|
cmake/templates/jsdefs.h.in cmake/templates/jsincludes.h.in)
|
2019-02-06 17:32:10 +01:00
|
|
|
if (ANDROID)
|
|
|
|
list(APPEND CMAKE_MODULE_FILES)
|
|
|
|
list(APPEND CMAKE_TEMPLATE_FILES cmake/templates/android-deployment.json.in)
|
|
|
|
endif ()
|
2017-03-14 22:45:33 +01:00
|
|
|
|
2019-02-06 17:32:10 +01:00
|
|
|
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
|
2017-01-07 16:46:53 +01:00
|
|
|
|
2019-02-06 17:32:10 +01:00
|
|
|
set(DOC_FILES README.md)
|
2016-06-10 23:05:43 +02:00
|
|
|
|
2016-07-16 23:12:02 +02:00
|
|
|
set(REQUIRED_ICONS
|
2016-09-03 20:19:17 +02:00
|
|
|
dialog-cancel
|
|
|
|
dialog-ok
|
|
|
|
dialog-ok-apply
|
2016-07-16 23:12:02 +02:00
|
|
|
document-open
|
|
|
|
document-open-recent
|
|
|
|
edit-clear
|
|
|
|
go-next
|
2016-08-31 23:38:35 +02:00
|
|
|
preferences-desktop-icons
|
|
|
|
preferences-desktop-locale
|
2016-09-03 20:19:17 +02:00
|
|
|
qtcreator
|
|
|
|
system-file-manager
|
|
|
|
system-run
|
|
|
|
system-search
|
2019-02-06 17:32:10 +01:00
|
|
|
window-close)
|
2016-07-16 23:12:02 +02:00
|
|
|
|
2019-02-06 17:32:10 +01:00
|
|
|
set(SCRIPT_FILES scripts/required_icons.sh)
|
2016-09-11 20:31:11 +02:00
|
|
|
|
2016-04-16 00:50:31 +02:00
|
|
|
# required to include CMake modules from own project directory
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" "${CMAKE_MODULE_PATH}")
|
2015-12-05 22:50:38 +01:00
|
|
|
|
2018-10-17 17:37:37 +02:00
|
|
|
# configure platform specific capslock detection for enterpassworddialog.cpp
|
2019-11-30 17:58:56 +01:00
|
|
|
if (WIN32
|
|
|
|
OR (UNIX
|
|
|
|
AND NOT APPLE
|
|
|
|
AND NOT ANDROID))
|
2018-10-17 17:37:37 +02:00
|
|
|
set(ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT ON)
|
2019-02-06 17:32:10 +01:00
|
|
|
else ()
|
2018-10-17 17:37:37 +02:00
|
|
|
set(ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT OFF)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2018-10-17 17:37:37 +02:00
|
|
|
option(CAPSLOCK_DETECTION "enables capslock detection" ${ENABLE_CAPSLOCK_DETECTION_BY_DEFAULT})
|
2019-02-06 17:32:10 +01:00
|
|
|
if (CAPSLOCK_DETECTION)
|
|
|
|
if (WIN32)
|
2018-10-17 17:37:37 +02:00
|
|
|
# WinAPI provides functions to provide capslock detection
|
|
|
|
set(HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION ON)
|
2019-02-06 17:32:10 +01:00
|
|
|
else ()
|
2018-10-17 17:37:37 +02:00
|
|
|
# X11 can provide functions for capslock detection under non-Windows environments
|
|
|
|
find_package(X11)
|
2019-02-06 17:32:10 +01:00
|
|
|
if (X11_FOUND)
|
2018-10-17 17:37:37 +02:00
|
|
|
list(APPEND LIBRARIES ${X11_LIBRARIES})
|
|
|
|
set(HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION ON)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
if (NOT HAVE_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
2018-10-17 17:37:37 +02:00
|
|
|
message(FATAL_ERROR "No backend for capslock detection found (WinAPI or X11 must be provided)")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2019-11-30 17:58:56 +01:00
|
|
|
set_property(
|
|
|
|
SOURCE enterpassworddialog/enterpassworddialog.cpp
|
|
|
|
APPEND
|
|
|
|
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_PLATFORM_SPECIFIC_CAPSLOCK_DETECTION)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2015-12-05 22:50:38 +01:00
|
|
|
|
2016-12-11 17:31:49 +01:00
|
|
|
# configure support for D-Bus notifications
|
2019-11-30 17:58:56 +01:00
|
|
|
if (UNIX
|
|
|
|
AND NOT APPLE
|
|
|
|
AND NOT ANDROID)
|
2017-08-06 00:39:30 +02:00
|
|
|
set(ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT ON)
|
2019-02-06 17:32:10 +01:00
|
|
|
else ()
|
2017-08-06 00:39:30 +02:00
|
|
|
set(ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT OFF)
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2017-08-06 00:39:30 +02:00
|
|
|
option(DBUS_NOTIFICATIONS "enables support for D-Bus notifications" ${ENABLE_DBUS_NOTIFICATIONS_BY_DEFAULT})
|
2016-12-11 17:31:49 +01:00
|
|
|
set(DBUS_NOTIFICATIONS_FILE_NAME misc/dbusnotification)
|
2019-02-06 17:32:10 +01:00
|
|
|
if (DBUS_NOTIFICATIONS)
|
|
|
|
list(APPEND HEADER_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.h)
|
|
|
|
list(APPEND SRC_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.cpp)
|
|
|
|
list(APPEND DBUS_FILES dbus/org.freedesktop.Notifications.xml)
|
2016-12-19 23:38:32 +01:00
|
|
|
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_SUPPORT_DBUS_NOTIFICATIONS)
|
2016-12-11 17:31:49 +01:00
|
|
|
message(STATUS "D-Bus notifications enabled")
|
2019-02-06 17:32:10 +01:00
|
|
|
else ()
|
2019-07-13 14:01:52 +02:00
|
|
|
list(APPEND EXCLUDED_FILES ${DBUS_NOTIFICATIONS_FILE_NAME}.h ${DBUS_NOTIFICATIONS_FILE_NAME}.cpp)
|
2016-12-11 17:31:49 +01:00
|
|
|
message(STATUS "D-Bus notifications disabled")
|
2019-02-06 17:32:10 +01:00
|
|
|
endif ()
|
2016-12-11 17:31:49 +01:00
|
|
|
|
2016-04-16 00:50:31 +02:00
|
|
|
# find c++utilities
|
2019-06-01 12:15:48 +02:00
|
|
|
set(CONFIGURATION_PACKAGE_SUFFIX
|
|
|
|
""
|
2019-05-04 20:59:19 +02:00
|
|
|
CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
|
2019-04-26 17:37:20 +02:00
|
|
|
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
2016-04-16 00:50:31 +02:00
|
|
|
use_cpp_utilities()
|
|
|
|
|
|
|
|
# include modules to apply configuration
|
|
|
|
include(BasicConfig)
|
|
|
|
include(QtGuiConfig)
|
2018-07-11 13:16:57 +02:00
|
|
|
|
|
|
|
# add further Qt modules (which are not automatically detected)
|
2016-11-10 23:40:03 +01:00
|
|
|
set(META_PUBLIC_QT_MODULES Core ${ADDITIONAL_QT_MODULES})
|
2018-07-11 13:16:57 +02:00
|
|
|
|
2017-04-27 22:03:37 +02:00
|
|
|
# include further modules to apply configuration
|
2016-04-16 00:50:31 +02:00
|
|
|
include(QtConfig)
|
|
|
|
include(WindowsResources)
|
|
|
|
include(LibraryTarget)
|
2016-06-10 23:05:43 +02:00
|
|
|
include(Doxygen)
|
2016-07-27 21:38:57 +02:00
|
|
|
include(ConfigHeader)
|