Warning, /frameworks/extra-cmake-modules/kde-modules/KDEFrameworkCompilerLegacySettings.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 #[=======================================================================[ 0009 Backward-compatibility support 0010 ------------------------------ 0011 0012 For all the non-KF projects which reused the KDEFrameworkCompilerSettings 0013 module to get more strict settings. 0014 0015 Kept as is, to be removed on next backward-compatibility-breakage occasion. 0016 #]=======================================================================] 0017 0018 if (NOT CMAKE_CXX_STANDARD) 0019 if (ECM_GLOBAL_FIND_VERSION VERSION_GREATER_EQUAL 5.84.0) 0020 set(CMAKE_CXX_STANDARD 17) 0021 set(CMAKE_CXX_STANDARD_REQUIRED ON) 0022 set(CMAKE_CXX_EXTENSIONS OFF) 0023 endif() 0024 endif() 0025 0026 include(KDECompilerSettings NO_POLICY_SCOPE) 0027 0028 add_definitions(-DQT_NO_CAST_TO_ASCII 0029 -DQT_NO_CAST_FROM_ASCII 0030 -DQT_NO_URL_CAST_FROM_STRING 0031 -DQT_NO_CAST_FROM_BYTEARRAY 0032 -DQT_USE_QSTRINGBUILDER 0033 -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT 0034 ) 0035 0036 if (NOT WIN32) 0037 # Strict iterators can't be used on Windows, they lead to a link error 0038 # when application code iterates over a QVector<QPoint> for instance, unless 0039 # Qt itself was also built with strict iterators. 0040 # See example at https://bugreports.qt.io/browse/AUTOSUITE-946 0041 add_definitions(-DQT_STRICT_ITERATORS) 0042 endif() 0043 0044 # Some non-KF projects make (ab)use of KDEFrameworkCompilerSettings currently, 0045 # let them only hit this as well when bumping their min. ECM requirement to a newer version. 0046 if (ECM_GLOBAL_FIND_VERSION VERSION_GREATER_EQUAL 5.79.0) 0047 add_definitions( 0048 -DQT_NO_KEYWORDS 0049 -DQT_NO_FOREACH 0050 ) 0051 else() 0052 add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS) 0053 endif() 0054 0055 add_definitions( 0056 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 0057 -DKF_DEPRECATED_WARNINGS_SINCE=0x060000 0058 ) 0059 0060 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 0061 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") 0062 endif() 0063 0064 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 0065 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0.0) 0066 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant" ) 0067 endif() 0068 endif() 0069 0070 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 0071 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.0.0) 0072 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant" ) 0073 endif() 0074 endif() 0075 0076 if (ECM_GLOBAL_FIND_VERSION VERSION_GREATER_EQUAL 5.80.0) 0077 include(KDEClangFormat) 0078 # add clang-format target 0079 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.hpp *.c) 0080 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) 0081 endif ()