diff --git a/CMakeLists.txt b/CMakeLists.txt index cf01148..0ad2511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,8 @@ else () endif () # find c++utilities -set(CONFIGURATION_PACKAGE_SUFFIX "" +set(CONFIGURATION_PACKAGE_SUFFIX + "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities") find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED) use_cpp_utilities() diff --git a/cmake/modules/AndroidApk.cmake b/cmake/modules/AndroidApk.cmake index 5e578fa..c77d96e 100644 --- a/cmake/modules/AndroidApk.cmake +++ b/cmake/modules/AndroidApk.cmake @@ -31,10 +31,7 @@ if (NOT EXISTS "${ANDROID_APK_MANIFEST_PATH}") message(FATAL_ERROR "The Android manifest doesn't exist at \"${ANDROID_APK_SUBDIR}/AndroidManifest.xml\".") endif () # caveat: adding new files or removing files requires to re-run CMake manually -file(GLOB_RECURSE ANDROID_APK_FILES - LIST_DIRECTORIES - false - "${ANDROID_APK_SUBDIR}/*") +file(GLOB_RECURSE ANDROID_APK_FILES LIST_DIRECTORIES false "${ANDROID_APK_SUBDIR}/*") # make subdirectory to store build artefacts for APK set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk") @@ -67,8 +64,10 @@ if (NOT ANDROID_APK_TOOLCHAIN_VERSION) endif () # determine Android build tools version note: Assuming the build tools are installed under "${CMAKE_ANDROID_SDK}/build-tools" -file(GLOB ANDROID_APK_BUILD_TOOLS_VERSIONS LIST_DIRECTORIES TRUE - RELATIVE "${CMAKE_ANDROID_SDK}/build-tools" "${CMAKE_ANDROID_SDK}/build-tools/*") +file(GLOB ANDROID_APK_BUILD_TOOLS_VERSIONS + LIST_DIRECTORIES TRUE + RELATIVE "${CMAKE_ANDROID_SDK}/build-tools" + "${CMAKE_ANDROID_SDK}/build-tools/*") if (NOT ANDROID_APK_BUILD_TOOLS_VERSIONS) message(FATAL_ERROR "No build-tools present under \"${CMAKE_ANDROID_SDK}/build-tools\".") endif () @@ -105,11 +104,14 @@ foreach (PATH ${ANDROID_APK_BINARY_DIRS}) # symlink "lib" subdirectory so androiddeployqt finds the library in the runtime path when specified via # "extraPrefixDirs" list(APPEND ANDROID_APK_BINARY_DIRS_DEPENDS "${PATH}/lib") - add_custom_command(OUTPUT "${PATH}/lib" - COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PATH}" "${PATH}/lib") + add_custom_command(OUTPUT "${PATH}/lib" COMMAND "${CMAKE_COMMAND}" -E create_symlink "${PATH}" "${PATH}/lib") endforeach () include(ListToString) -list_to_string("" "\n \"" "\"," "${ANDROID_APK_BINARY_DIRS}" ANDROID_APK_BINARY_DIRS) +list_to_string("" + "\n \"" + "\"," + "${ANDROID_APK_BINARY_DIRS}" + ANDROID_APK_BINARY_DIRS) # find dependencies note: androiddeployqt seems to find only Qt libraries and plugins but misses other target_link_libraries set(ANDROID_APK_ADDITIONAL_LIBS "" CACHE STRING "additional libraries to be bundled into the Android APK") @@ -135,10 +137,17 @@ function (add_android_apk_extra_libs TARGET_NAME) set(ANDROID_APK_EXTRA_LIBS "${ANDROID_APK_EXTRA_LIBS}" PARENT_SCOPE) endfunction () add_android_apk_extra_libs("${META_TARGET_NAME}") -list_to_string("," "" "" "${ANDROID_APK_EXTRA_LIBS}" ANDROID_APK_EXTRA_LIBS) +list_to_string("," + "" + "" + "${ANDROID_APK_EXTRA_LIBS}" + ANDROID_APK_EXTRA_LIBS) # query certain qmake variables -foreach (QMAKE_VARIABLE QT_INSTALL_QML QT_INSTALL_PLUGINS QT_INSTALL_IMPORTS) +foreach (QMAKE_VARIABLE + QT_INSTALL_QML + QT_INSTALL_PLUGINS + QT_INSTALL_IMPORTS) query_qmake_variable(${QMAKE_VARIABLE}) endforeach () @@ -148,7 +157,11 @@ function (compose_dirs_for_android_apk) set(OPTIONAL_ARGS) set(ONE_VALUE_ARGS OUTPUT_VARIABLE) set(MULTI_VALUE_ARGS POSSIBLE_DIRS) - cmake_parse_arguments(ARGS "${OPTIONAL_ARGS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN}) + cmake_parse_arguments(ARGS + "${OPTIONAL_ARGS}" + "${ONE_VALUE_ARGS}" + "${MULTI_VALUE_ARGS}" + ${ARGN}) list(REMOVE_DUPLICATES ARGS_POSSIBLE_DIRS) unset(DIRS) @@ -158,7 +171,11 @@ function (compose_dirs_for_android_apk) endif () endforeach () - list_to_string("," "" "" "${DIRS}" DIRS) + list_to_string("," + "" + "" + "${DIRS}" + DIRS) set("${ARGS_OUTPUT_VARIABLE}" "${DIRS}" PARENT_SCOPE) endfunction () diff --git a/cmake/modules/QtConfig.cmake b/cmake/modules/QtConfig.cmake index bf844b4..d318ab5 100644 --- a/cmake/modules/QtConfig.cmake +++ b/cmake/modules/QtConfig.cmake @@ -63,7 +63,11 @@ foreach (MODULE ${QT_MODULES}) if ("${MODULE}" IN_LIST META_PUBLIC_QT_MODULES) list(APPEND MODULE_OPTIONS VISIBILITY PUBLIC) endif () - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE "${MODULE}" ${MODULE_OPTIONS}) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + "${MODULE}" + ${MODULE_OPTIONS}) endforeach () set(KF_PACKAGE_PREFIX "KF5" CACHE STRING "specifies the prefix for KDE Frameworks packages") foreach (MODULE ${KF_MODULES}) @@ -71,7 +75,11 @@ foreach (MODULE ${KF_MODULES}) if ("${MODULE}" IN_LIST META_PUBLIC_KF_MODULES) list(APPEND MODULE_OPTIONS VISIBILITY PUBLIC) endif () - use_qt_module(PREFIX "${KF_PACKAGE_PREFIX}" MODULE "${MODULE}" ${MODULE_OPTIONS}) + use_qt_module(PREFIX + "${KF_PACKAGE_PREFIX}" + MODULE + "${MODULE}" + ${MODULE_OPTIONS}) endforeach () # hack for using static Qt via "StaticQt5" prefix: find regular Qt5Core module as well so Qt version is defined @@ -97,11 +105,29 @@ if (STATIC_LINKAGE AND META_PROJECT_IS_APPLICATION) if (Gui IN_LIST QT_MODULES OR Widgets IN_LIST QT_MODULES OR Quick IN_LIST QT_MODULES) if (WIN32) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Gui PLUGINS WindowsIntegration ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Gui + PLUGINS + WindowsIntegration + ONLY_PLUGINS) elseif (APPLE) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Gui PLUGINS CocoaIntegration ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Gui + PLUGINS + CocoaIntegration + ONLY_PLUGINS) elseif (TARGET ${QT5_Gui_STATIC_PREFIX}QXcbIntegrationPlugin) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Gui PLUGINS XcbIntegration ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Gui + PLUGINS + XcbIntegration + ONLY_PLUGINS) else () message(WARNING "The required platform plugin for your platform is unknown an can not be linked in statically.") endif () @@ -114,7 +140,13 @@ if (STATIC_LINKAGE AND META_PROJECT_IS_APPLICATION) if (Widgets IN_LIST QT_MODULES) foreach (WIDGET_STYLE_PLUGIN ${KNOWN_WIDGET_STYLE_PLUGINS}) if (TARGET "${QT_PACKAGE_PREFIX}::Q${WIDGET_STYLE_PLUGIN}Plugin") - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Widgets PLUGINS ${WIDGET_STYLE_PLUGIN} ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Widgets + PLUGINS + ${WIDGET_STYLE_PLUGIN} + ONLY_PLUGINS) list(APPEND USED_WIDGET_STYLE_PLUGINS "${WIDGET_STYLE_PLUGIN}") endif () endforeach () @@ -137,27 +169,48 @@ if (STATIC_LINKAGE AND META_PROJECT_IS_APPLICATION) set(SVG_SUPPORT ON) list(REMOVE_ITEM IMAGE_FORMAT_SUPPORT Svg) else () - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Gui PLUGINS ${IMAGE_FORMAT} ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Gui + PLUGINS + ${IMAGE_FORMAT} + ONLY_PLUGINS) endif () endforeach () # allow importing image format plugins via config.h - list_to_string(" " "\\\n Q_IMPORT_PLUGIN(Q" "Plugin)" "${IMAGE_FORMAT_SUPPORT}" IMAGE_FORMAT_SUPPORT_ARRAY) + list_to_string(" " + "\\\n Q_IMPORT_PLUGIN(Q" + "Plugin)" + "${IMAGE_FORMAT_SUPPORT}" + IMAGE_FORMAT_SUPPORT_ARRAY) endif () # ensure SVG plugins are built-in if configured - if ((SVG_SUPPORT OR SVG_ICON_SUPPORT) - AND NOT - Svg - IN_LIST - QT_MODULES) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Svg) + if ((SVG_SUPPORT OR SVG_ICON_SUPPORT) AND NOT Svg IN_LIST QT_MODULES) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Svg) endif () if (SVG_SUPPORT) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Svg PLUGINS Svg ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Svg + PLUGINS + Svg + ONLY_PLUGINS) endif () if (SVG_ICON_SUPPORT) - use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE Svg PLUGINS SvgIcon ONLY_PLUGINS) + use_qt_module(PREFIX + "${QT_PACKAGE_PREFIX}" + MODULE + Svg + PLUGINS + SvgIcon + ONLY_PLUGINS) endif () endif () @@ -199,7 +252,11 @@ foreach (QT_TRANSLATION_PATH ${QT_TRANSLATION_SEARCH_PATHS}) endforeach () # make relevant Qt translations available as array via config.h -list_to_string("," " \\\n QStringLiteral(\"" "\")" "${QT_TRANSLATION_FILES}" QT_TRANSLATION_FILES_ARRAY) +list_to_string("," + " \\\n QStringLiteral(\"" + "\")" + "${QT_TRANSLATION_FILES}" + QT_TRANSLATION_FILES_ARRAY) # enable lrelease and add install target for localization option(ENABLE_QT_TRANSLATIONS "specifies whether Qt translations should be updated/released" ON) @@ -238,7 +295,8 @@ if (ENABLE_QT_TRANSLATIONS AND TS_FILES) if (NOT TARGET install-localization) set(LOCALIZATION_TARGET "install-localization") add_custom_target(${LOCALIZATION_TARGET} - COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=localization -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") add_dependencies(${LOCALIZATION_TARGET} ${META_PROJECT_NAME}_translations) endif () @@ -321,16 +379,11 @@ if (REQUIRED_ICONS) # find index files if (NOT ICON_THEME STREQUAL FALLBACK_ICON_THEME) file(GLOB GLOBBED_ICON_THEME_INDEX_FILES - LIST_DIRECTORIES - false - "${ICON_THEME_PATH}/index.theme" - "${ICON_THEME_PATH}/icon-theme.cache") + LIST_DIRECTORIES false + "${ICON_THEME_PATH}/index.theme" "${ICON_THEME_PATH}/icon-theme.cache") else () # only index.theme required when icons are provided as fallback anyways - file(GLOB GLOBBED_ICON_THEME_INDEX_FILES - LIST_DIRECTORIES - false - "${ICON_THEME_PATH}/index.theme") + file(GLOB GLOBBED_ICON_THEME_INDEX_FILES LIST_DIRECTORIES false "${ICON_THEME_PATH}/index.theme") endif () # make the first specified built-in the default theme if (NOT EXISTS "${DEFAULT_THEME_INDEX_FILE}") @@ -348,10 +401,7 @@ if (REQUIRED_ICONS) "${ICON_THEME_PATH}/*/${REQUIRED_ICON}" "${ICON_THEME_PATH}/*/${REQUIRED_ICON}.*") endforeach () - file(GLOB_RECURSE GLOBBED_ICON_THEME_FILES - LIST_DIRECTORIES - false - ${GLOB_PATTERNS}) + file(GLOB_RECURSE GLOBBED_ICON_THEME_FILES LIST_DIRECTORIES false ${GLOB_PATTERNS}) else () message( STATUS diff --git a/cmake/modules/QtGuiConfig.cmake b/cmake/modules/QtGuiConfig.cmake index e1a817d..6585ab5 100644 --- a/cmake/modules/QtGuiConfig.cmake +++ b/cmake/modules/QtGuiConfig.cmake @@ -83,7 +83,8 @@ list(APPEND ADDITIONAL_HEADER_FILES ${GUI_HEADER_FILES}) # add option for enabling/disabling static Qt plugins option(SVG_SUPPORT "whether to link against the SVG image format plugin (only relevant when using static Qt)" ON) option(SVG_ICON_SUPPORT "whether to link against the SVG icon engine (only relevant when using static Qt)" ON) -set(IMAGE_FORMAT_SUPPORT "Gif;ICO;Jpeg" +set(IMAGE_FORMAT_SUPPORT + "Gif;ICO;Jpeg" CACHE STRING "specifies the image format plugins to link against (only relevant when using static Qt)") # always enable the Svg module under Android diff --git a/cmake/modules/QtLinkage.cmake b/cmake/modules/QtLinkage.cmake index 6ffeb29..1034bac 100644 --- a/cmake/modules/QtLinkage.cmake +++ b/cmake/modules/QtLinkage.cmake @@ -20,9 +20,17 @@ endif () macro (use_qt_module) # parse arguments set(OPTIONAL_ARGS ONLY_PLUGINS) - set(ONE_VALUE_ARGS PREFIX MODULE VISIBILITY LIBRARIES_VARIABLE) + set(ONE_VALUE_ARGS + PREFIX + MODULE + VISIBILITY + LIBRARIES_VARIABLE) set(MULTI_VALUE_ARGS TARGETS PLUGINS) - cmake_parse_arguments(ARGS "${OPTIONAL_ARGS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN}) + cmake_parse_arguments(ARGS + "${OPTIONAL_ARGS}" + "${ONE_VALUE_ARGS}" + "${MULTI_VALUE_ARGS}" + ${ARGN}) # validate values if (NOT ARGS_PREFIX) @@ -91,7 +99,10 @@ macro (use_qt_module) endforeach () # unset variables (can not simply use a function because Qt's variables need to be exported) - foreach (ARGUMENT ${OPTIONAL_ARGS} ${ONE_VALUE_ARGS} ${MULTI_VALUE_ARGS}) + foreach (ARGUMENT + ${OPTIONAL_ARGS} + ${ONE_VALUE_ARGS} + ${MULTI_VALUE_ARGS}) unset(ARGS_${ARGUMENT}) endforeach () endmacro ()