Warning, /utilities/kcalc/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 # KDE Application Version, managed by release script
0004 set (RELEASE_SERVICE_VERSION_MAJOR "22")
0005 set (RELEASE_SERVICE_VERSION_MINOR "11")
0006 set (RELEASE_SERVICE_VERSION_MICRO "70")
0007 set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0008 project(kcalc VERSION ${RELEASE_SERVICE_VERSION})
0009 
0010 set(QT_MIN_VERSION "5.15.2")
0011 set(KF5_MIN_VERSION "5.90.0")
0012 
0013 find_package (ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
0014 set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
0015 
0016 include(KDEInstallDirs)
0017 include(KDECompilerSettings NO_POLICY_SCOPE)
0018 include(KDECMakeSettings)
0019 include(ECMMarkAsTest)
0020 include(FeatureSummary)
0021 include(ECMAddAppIcon)
0022 include(ECMSetupVersion)
0023 include(KDEGitCommitHooks)
0024 include(KDEClangFormat)
0025 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
0026 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0027 
0028 ## Generate header with version number
0029 ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KCALC
0030                   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcalc_version.h"
0031 )
0032 
0033 find_package (Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
0034     Core
0035     Widgets
0036 )
0037 if (QT_MAJOR_VERSION STREQUAL "6")
0038     find_package(Qt6Core5Compat)
0039 endif()
0040 
0041 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
0042     CoreAddons
0043     Crash
0044     Config
0045     ConfigWidgets
0046     GuiAddons
0047     I18n
0048     Notifications
0049     XmlGui
0050 )
0051 
0052 find_package(KF5DocTools ${KF5_MIN_VERSION})
0053 set_package_properties(KF5DocTools PROPERTIES DESCRIPTION
0054     "Tools to generate documentation"
0055     TYPE OPTIONAL
0056 )
0057 
0058 set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" ${CMAKE_SOURCE_DIR}/cmake/modules)
0059 
0060 find_package(GMP)
0061 set_package_properties(GMP PROPERTIES
0062     DESCRIPTION "The GNU Multiple Precision Arithmetic Library"
0063     URL "https://gmplib.org/"
0064     TYPE REQUIRED
0065     PURPOSE "Required for building KCalc."
0066 )
0067 
0068 find_package(MPFR)
0069 set_package_properties(MPFR PROPERTIES
0070     DESCRIPTION "The GNU Multiple Precision Floating-Point Reliable Library"
0071     URL "https://www.mpfr.org/"
0072     TYPE REQUIRED
0073     PURPOSE "Required for building KCalc."
0074 )
0075 
0076 include(CheckTypeSize)
0077 include(CheckIncludeFiles)
0078 
0079 check_include_files(ieeefp.h     HAVE_IEEEFP_H)
0080 check_type_size("signed long"    SIZEOF_SIGNED_LONG)
0081 check_type_size("unsigned long"  SIZEOF_UNSIGNED_LONG)
0082 
0083 configure_file(config-kcalc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kcalc.h )
0084 add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
0085 add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800)
0086 
0087 add_subdirectory(knumber)
0088 add_executable(kcalc)
0089 
0090 target_sources(kcalc PRIVATE
0091    kcalc.cpp 
0092    bitbutton.cpp
0093    kcalc_bitset.cpp
0094    kcalc_button.cpp 
0095    kcalc_const_button.cpp 
0096    kcalc_const_menu.cpp 
0097    kcalc_core.cpp 
0098    kcalcdisplay.cpp 
0099    kcalc_statusbar.cpp
0100    stats.cpp 
0101    kcalc.qrc
0102    kcalchistory.cpp
0103    stats.cpp
0104    kcalc_const_menu.h
0105    kcalc_core.h
0106    kcalc_bitset.h
0107    bitbutton.h
0108    kcalc.h
0109    kcalc_button.h
0110    stats.h
0111    kcalc_const_button.h
0112    kcalc_statusbar.h
0113    kcalcdisplay.h
0114    kcalchistory.h
0115    kcalc.qrc )
0116 
0117 
0118 ki18n_wrap_ui(kcalc
0119    kcalc.ui
0120    constants.ui
0121    colors.ui
0122    fonts.ui
0123    general.ui)
0124 
0125 kconfig_add_kcfg_files(kcalc kcalc_settings.kcfgc )
0126 
0127 # Sets the icon on Windows and OSX
0128 file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/*.png")
0129 ecm_add_app_icon(kcalc ICONS ${ICONS_SRCS})
0130 
0131 # Conditionally install icons for Linux as they may not be provided by the user theme
0132 option(INSTALL_ICONS "Install icons" OFF)
0133 if (INSTALL_ICONS)
0134     include(ECMInstallIcons)
0135     ecm_install_icons( ICONS ${ICONS_SRCS} DESTINATION ${KDE_INSTALL_ICONDIR} )
0136 endif()
0137 
0138 
0139 target_link_libraries(kcalc
0140     Qt${QT_MAJOR_VERSION}::Core
0141     Qt${QT_MAJOR_VERSION}::Widgets
0142     KF5::CoreAddons
0143     KF5::ConfigWidgets
0144     KF5::GuiAddons
0145     KF5::I18n
0146     KF5::Notifications
0147     KF5::XmlGui
0148     KF5::Crash
0149     knumber
0150 )
0151 
0152 set_target_properties(kcalc PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in)
0153 
0154 install(TARGETS kcalc  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
0155 
0156 ########### install files ###############
0157 
0158 install( PROGRAMS org.kde.kcalc.desktop  DESTINATION ${KDE_INSTALL_APPDIR})
0159 install( FILES org.kde.kcalc.appdata.xml   DESTINATION ${KDE_INSTALL_METAINFODIR})
0160 install( FILES kcalc.kcfg  DESTINATION ${KDE_INSTALL_KCFGDIR})
0161 install( FILES kcalcrc.upd  DESTINATION ${KDE_INSTALL_DATADIR}/kconf_update)
0162 
0163 ki18n_install(po)
0164 if (KF5DocTools_FOUND)
0165     kdoctools_install(po)
0166     add_subdirectory(doc)
0167 endif()
0168 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0169 
0170 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)