Warning, /sdk/kdiff3/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de 0002 # SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com 0003 # SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #cmake < 3.1 has no sane way of checking C++11 features and needed flags 0006 #CMP0077 is defined in 3.13 or later 0007 cmake_minimum_required(VERSION 3.14 FATAL_ERROR) 0008 0009 project(kdiff3 VERSION 1.10.1) 0010 0011 option(BUILD_WITH_QT6 OFF) 0012 option(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE ON) 0013 option(CMAKE_CXX_EXTENSIONS ON ) #disable trigraphs in clang/gcc -- officially removed in c++17 0014 option(CMAKE_EXPORT_COMPILE_COMMANDS ON) 0015 #Avaliable as QtVersionOption starting in ECM 5.82. 0016 option(BUILD_WITH_QT6 "Build against Qt 6" OFF) 0017 if (BUILD_WITH_QT6) 0018 set(QT_MAJOR_VERSION 6) 0019 else() 0020 set(QT_MAJOR_VERSION 5) 0021 endif() 0022 0023 set(ECM_MIN_VERSION "5.50.0") 0024 set(QT_MIN_VERSION "5.15.2") 0025 0026 set(KF5_MIN_VERSION "5.50.0") 0027 0028 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.2) 0029 message(WARNING "gcc < 8.2 is not recomended support is best effort-only.") 0030 endif() 0031 0032 0033 find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED) 0034 set( 0035 CMAKE_MODULE_PATH 0036 ${CMAKE_MODULE_PATH} 0037 ${ECM_MODULE_PATH} 0038 ) 0039 0040 include(KDEInstallDirs) 0041 include(KDECompilerSettings NO_POLICY_SCOPE) 0042 include(KDECMakeSettings NO_POLICY_SCOPE) 0043 include(FeatureSummary) 0044 0045 include(ECMInstallIcons) 0046 include(ECMAddAppIcon) 0047 include(ECMSetupVersion) 0048 include(ECMAddTests) 0049 include(ECMOptionalAddSubdirectory) 0050 0051 ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX KDIFF3 VERSION_HEADER ${CMAKE_BINARY_DIR}/src/version.h) 0052 0053 # Some older versions on boost contain a bug that prevents compiling gcc offers a built-in workaround 0054 # but that isn't enough to ship as clang has no such workaround. 1.65 is known to be affected. 0055 # 0056 # 1.71 or later is required for safe_numerics to work on MSVC otherwise we get a link-time error. 0057 find_package(Boost 1.71 REQUIRED) 0058 0059 #needed on craft and possiablely other custom setups. 0060 include_directories(${Boost_INCLUDE_DIRS}) 0061 0062 find_package( 0063 Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} 0064 CONFIG 0065 REQUIRED 0066 COMPONENTS 0067 Core 0068 Gui 0069 Widgets 0070 PrintSupport 0071 ) 0072 0073 find_package( 0074 KF5 ${KF5_MIN_VERSION} 0075 REQUIRED 0076 COMPONENTS 0077 I18n 0078 CoreAddons 0079 Parts 0080 WidgetsAddons 0081 Config 0082 Crash 0083 OPTIONAL_COMPONENTS 0084 DocTools 0085 ) 0086 0087 set_package_properties(KF5DocTools PROPERTIES PURPOSE "Allows generating and installing docs.") 0088 0089 string(REPLACE "." ";" VERSION_LIST "${KF5_VERSION}") 0090 list(GET VERSION_LIST 0 KF_VERSION_MAJOR) 0091 list(GET VERSION_LIST 1 KF_VERSION_MINOR) 0092 list(GET VERSION_LIST 2 KF_VERSION_PATCH) 0093 0094 option(ENABLE_AUTO "Enable kdiff3's '--auto' flag" ON) 0095 option(ENABLE_CLANG_TIDY "Run clang-tidy if available and cmake version >=3.6" OFF) 0096 0097 set(CMAKE_CXX_STANDARD 17) 0098 0099 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 0100 if(ENABLE_CLAZY) 0101 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -plugin-arg-clazy -Xclang level0,level1,no-overloaded-signal,auto-unexpected-qstringbuilder,unused-non-trivial-variable,returning-void-expression,isempty-vs-count,container-inside-loop,assert-with-side-effects") 0102 endif() 0103 #Adjust clang specific warnings 0104 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -fexceptions") 0105 set(CLANG_WARNING_FLAGS "-Wno-undef -Wno-trigraphs -Wno-invalid-pp-token -Wno-comment -Wshorten-64-to-32 -Wstring-conversion -Wc++11-narrowing -fstack-protector-all") 0106 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_WARNING_FLAGS}") 0107 elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 0108 #Make MSVC obey standard C++ exception handling by destroying all objects going out of scope as a result of the exception. 0109 #This also separates a Microsoft specific exention SEH which catches non-c++ asynchronous exceptions. 0110 add_compile_options("/EHsc") 0111 #Suppress MSVCs min/max macros 0112 add_definitions(-DNOMINMAX) 0113 #Suppress Microsoft specfic C4996 "deprecatation" warnings. Not helpful for code intended to run on any other platform. 0114 add_definitions(-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS_GLOBALS) 0115 elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 0116 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-trigraphs -Wduplicated-cond -Wduplicated-branches -Wshadow -fexceptions") 0117 endif() 0118 0119 #new in cmake 3.6+ integrate clang-tidy 0120 if(ENABLE_CLANG_TIDY) 0121 find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable") 0122 if(NOT CLANG_TIDY_EXE) 0123 message(STATUS "clang-tidy not found disabling integration.") 0124 else() 0125 message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}") 0126 set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" "-header-filter=.*") 0127 endif() 0128 endif() 0129 0130 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") 0131 0132 if(ENABLE_AUTO) 0133 add_definitions( 0134 -DENABLE_AUTO 0135 ) 0136 endif() 0137 0138 add_definitions( 0139 -DQT_DEPRECATED_WARNINGS #Get warnings from QT about deprecated functions. 0140 -DQT_NO_URL_CAST_FROM_STRING # casting from string to url does not always behave as you might think 0141 -DQT_RESTRICTED_CAST_FROM_ASCII #casting from char*/QByteArray to QString can produce unexpected results for non-latin characters. 0142 -DQT_NO_KEYWORDS 0143 -DQT_NO_CAST_TO_ASCII 0144 -DQT_NO_PROCESS_COMBINED_ARGUMENT_START 0145 -DQT_DEPRECATED_WARNINGS_SINCE=0x050F00#warn if deprecated at 5.15 or before. Qt default setting is not useful for kdiff3. 0146 -DQT_DISABLE_DEPRECATED_BEFORE=0x050F00#disable deprecated api for Qt<5.15. 0147 #Boost 1.74 and possibly others trigger these warnings in boosts own internal headers making 0148 #the warning useless. 0149 -DBOOST_ALLOW_DEPRECATED_HEADERS 0150 #KF5 5.64+ flags 0151 #Don't warn for API depreciated after 5.70.0 (below as hex.hex.hex number) 0152 -DKF_DEPRECATED_WARNINGS_SINCE=0x054600 0153 -DKIOCORE_DEPRECATED_WARNINGS_SINCE=0x054600 0154 -DKXMLGUI_DEPRECATED_WARNINGS_SINCE=0x054600 0155 -DKF_VERSION_MAJOR=${KF_VERSION_MAJOR} 0156 -DKF_VERSION_MINOR=${KF_VERSION_MINOR} 0157 -DKF_VERSION_PATCH=${KF_VERSION_PATCH} 0158 ) 0159 0160 add_subdirectory(src) 0161 if(KF5DocTools_FOUND) 0162 ecm_optional_add_subdirectory(doc) 0163 kdoctools_install(po) 0164 else() 0165 message(WARNING "DocTools not found. Docs will not be generated.") 0166 endif() 0167 0168 ki18n_install(po) 0169 0170 add_subdirectory(kdiff3fileitemactionplugin) 0171 0172 if(WIN32) 0173 add_subdirectory(diff_ext_for_kdiff3) 0174 endif() 0175 0176 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)