Warning, /frameworks/extra-cmake-modules/kde-modules/KDEFrameworkCompilerSettings.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2013 Albert Astals Cid <aacid@kde.org>
0002 # SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
0003 # SPDX-FileCopyrightText: 2006-2007 Laurent Montel <montel@kde.org>
0004 # SPDX-FileCopyrightText: 2006-2013 Alex Neundorf <neundorf@kde.org>
0005 #
0006 # SPDX-License-Identifier: BSD-3-Clause
0007 
0008 #[=======================================================================[.rst:
0009 KDEFrameworkCompilerSettings
0010 ----------------------------
0011 
0012 Set stricter compile and link flags for KDE Frameworks modules.
0013 
0014 .. warning::
0015    Do not use this module for software which is not part of KDE-Frameworks.
0016    There is no guarantee for backward-compatibility in newer versions.
0017 
0018 The :kde-module:`KDECompilerSettings` module is included and, in addition, various
0019 defines that affect the Qt libraries are set to enforce certain
0020 conventions.
0021 
0022 For example, constructions like ``QString("foo")`` are prohibited, instead
0023 forcing the use of QLatin1String or QStringLiteral, and some
0024 Qt-defined keywords like signals and slots will not be defined.
0025 
0026 .. note::
0027   It is recommended to include this module with the NO_POLICY_SCOPE
0028   flag, otherwise you may get spurious warnings with some versions of CMake.
0029 
0030 Since pre-1.0.0.
0031 #]=======================================================================]
0032 
0033 # No-one else should be using this module, at least by the time when requiring
0034 # ECM 5.85 as minimum, where also settings levels had been introduced for
0035 # KDECompilerSettings to satisfy the needs for stricter out-of-the-box
0036 # settings.
0037 # So making a clear cut here by that condition and providing backward-compat
0038 # support from a separate file with the old code, avoiding the need for
0039 # further if()-else() when changing the settings for current KDE Frameworks.
0040 if (ECM_GLOBAL_FIND_VERSION VERSION_LESS 5.85.0)
0041     include(KDEFrameworkCompilerLegacySettings NO_POLICY_SCOPE)
0042     return()
0043 endif()
0044 
0045 # set ENABLE_BSYMBOLICFUNCTIONS default to ON when possible
0046 # TODO: find a nice way to set an option default
0047 # we can only use symbolic functions when everything is built with that
0048 # otherwise we'll break function pointer based connects and method lookups
0049 include(${CMAKE_CURRENT_LIST_DIR}/../modules/QtVersionOption.cmake)
0050 if (QT_MAJOR_VERSION EQUAL "6")
0051     find_package(Qt6Core)
0052     set(ENABLE_BSYMBOLICFUNCTIONS ${QT_FEATURE_reduce_relocations})
0053     set(CMAKE_CXX_STANDARD 20)
0054     set(CMAKE_CXX_EXTENSIONS OFF)
0055     set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
0056 else ()
0057     set(ENABLE_BSYMBOLICFUNCTIONS ON)
0058 endif()
0059 
0060 # Current defaults
0061 include(KDECompilerSettings NO_POLICY_SCOPE)
0062 
0063 # add clang-format target
0064 include(KDEClangFormat)
0065 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.hpp *.c)
0066 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0067 
0068 # add the metainfo platform check
0069 include(KDEMetaInfoPlatformCheck)