Warning, /sdk/ktechlab/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # cmake CXX_STANDARD needs min cmake 3.1
0002 # https://stackoverflow.com/questions/10984442/how-to-detect-c11-support-of-a-compiler-with-cmake/20165220#20165220
0003 cmake_minimum_required(VERSION 3.1)
0004 
0005 #set( KTECHLAB_DEVELOPER_BUILD "true" )
0006 
0007 project( ktechlab )
0008 set( VERSION 0.50.0 )
0009 
0010 # set(CMAKE_DEBUG_TARGET_PROPERTIES INCLUDE_DIRECTORIES)
0011 
0012 find_package(ECM 5.14.0 CONFIG REQUIRED)
0013 
0014 # At least C++14 is required for qOverload MACRO
0015 set(CMAKE_CXX_STANDARD 14)
0016 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0017 
0018 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
0019 
0020 include(KDEInstallDirs)
0021 include(KDECMakeSettings)
0022 include(KDECompilerSettings NO_POLICY_SCOPE)
0023 include(KDEClangFormat OPTIONAL RESULT_VARIABLE KDEClangFormat_FOUND)
0024 include(ECMSetupVersion)
0025 include(ECMQtDeclareLoggingCategory)
0026 
0027 include(ECMInstallIcons)
0028 include(FeatureSummary)
0029 
0030 ecm_setup_version(
0031     "${VERSION}"
0032     VARIABLE_PREFIX KTECHLAB
0033     VERSION_HEADER ktechlab_version.h
0034 )
0035 
0036 if(BUILD_TESTING)
0037     set(QT_ADDITIONAL_COMPONENTS Test)
0038 endif()
0039 find_package(Qt5 CONFIG REQUIRED COMPONENTS
0040     Core
0041     DBus
0042     Widgets
0043     PrintSupport
0044     SerialPort
0045     ${QT_ADDITIONAL_COMPONENTS}
0046     )
0047 
0048 find_package(KF5 REQUIRED COMPONENTS
0049     Completion
0050     Config
0051     ConfigWidgets
0052     CoreAddons
0053     DocTools
0054     IconThemes
0055     I18n
0056     KIO
0057     Parts
0058     TextEditor
0059     TextWidgets
0060     WidgetsAddons
0061     WindowSystem
0062     XmlGui
0063     )
0064 
0065 # Edit FindGPSim and replace
0066 #    include(MacroPushRequiredVars) -> include(CMakePushCheckState)
0067 #    macro_push_required_vars() -> cmake_push_check_state()
0068 #    macro_pop_required_vars() -> cmake_pop_check_state()
0069 find_package(GPSim)
0070 
0071 add_definitions(-fPIC)
0072 add_definitions(
0073     -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 # TODO target some reasonable version
0074     -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 # to enable warnings for API since the disabled limit
0075 #     -DQT_USE_QSTRINGBUILDER # TODO
0076 #     -DQT_NO_CAST_TO_ASCII # TODO
0077 #     -DQT_NO_CAST_FROM_ASCII # TODO
0078 #     -DQT_NO_CAST_FROM_BYTEARRAY # TODO
0079 #     -DQT_STRICT_ITERATORS # TODO
0080     -DQT_NO_URL_CAST_FROM_STRING
0081 #     -DQT_NO_KEYWORDS # TODO
0082     -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
0083 #    -DQT_NO_FOREACH # needed by KConfig system at least on Ubuntu 18.04
0084     -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x050000
0085     -DKF_DEPRECATED_WARNINGS_SINCE=0x060000 # to enable warnings for API since the disabled limit
0086 )
0087 
0088 #set(CMAKE_VERBOSE_MAKEFILE ON)
0089 
0090 if (KTECHLAB_DEVELOPER_BUILD)
0091 # for debugging with GCC 5
0092     add_definitions( -fno-omit-frame-pointer )
0093     set(SANITIZE_FLAGS " -fsanitize=address -fno-omit-frame-pointer -fPIC") # address
0094     #set(SANITIZE_FLAGS " -fsanitize=undefined -fno-omit-frame-pointer ") # undefined
0095     #set(SANITIZE_FLAGS "") # disabled
0096 
0097     #add_definitions ( -DQT3_SUPPORT_WARNINGS )
0098 
0099     add_definitions( ${SANITIZE_FLAGS} )
0100     SET( CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZE_FLAGS}" )
0101 
0102     #add_definitions( -Wold-style-cast ) # warn on old style casts. as these could introduce bugs
0103 
0104 endif (KTECHLAB_DEVELOPER_BUILD)
0105 
0106 add_definitions( -fno-inline )  # do not inline any method calls; this is useful for crash debugging
0107 add_definitions(
0108     ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}
0109     ${GLIB2_DEFINITIONS}
0110 )
0111 
0112 message("Qt5Core_EXECUTABLE_COMPILE_FLAGS=>>>${Qt5Core_EXECUTABLE_COMPILE_FLAGS}<<<" )
0113 
0114 
0115 # KDE disables STL compatibility by default; re-enabling it is supported
0116 # see http://kde.6490.n7.nabble.com/QT-NO-STL-in-KDE4-td1123882i20.html
0117 # and http://www.cmake.org/Wiki/HowToBuildKDE4Software#Some_useful_functions
0118 remove_definitions(-DQT_NO_STL)
0119 
0120 # TODO switch to NO_GPSIM to HAVE_GPSIM
0121 if (NOT GPSim_FOUND)
0122     set(NO_GPSIM TRUE)
0123 endif ()
0124 
0125 include_directories(
0126     # for config.h file
0127     ${CMAKE_CURRENT_BINARY_DIR}
0128 )
0129 
0130 set( SRC_TESTS_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/data/ )
0131 
0132 CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/config.h.cmake
0133         ${CMAKE_BINARY_DIR}/config.h )
0134 
0135 
0136 # message(STATUS "include_dir begin")
0137 # get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
0138 # foreach(dir ${dirs})
0139 #   message(STATUS "include_dir='${dir}'")
0140 # endforeach()
0141 # message(STATUS "include_dir end")
0142 
0143 # message(STATUS "variables begin")
0144 # get_cmake_property(_variableNames VARIABLES)
0145 # list (SORT _variableNames)
0146 # foreach (_variableName ${_variableNames})
0147 #     message(STATUS "${_variableName}=${${_variableName}}")
0148 # endforeach()
0149 # message(STATUS "variables end")
0150 
0151 add_subdirectory( microbe )
0152 add_subdirectory( src )
0153 add_subdirectory( examples )
0154 add_subdirectory( icons )
0155 add_subdirectory( icons-kde3 )
0156 add_subdirectory( doc )
0157 
0158 if(BUILD_TESTING)
0159     add_subdirectory(tests)
0160 endif()
0161 
0162 ki18n_install(po)
0163 
0164 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0165 
0166 # add clang-format target for all our real source files
0167 if(KDEClangFormat_FOUND)
0168     file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
0169     kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0170 endif()