Library for managing partitions. Common code for KDE Partition Manager and other projects. https://www.kde.org/applications/system/kdepartitionmanager/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Copyright (C) 2008 by Volker Lanz <vl@fidra.de>
  2. # Copyright (C) 2014-2019 by Andrius Štikonas <andrius@stikonas.eu>
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License as
  6. # published by the Free Software Foundation; either version 3 of
  7. # the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. project(kpmcore)
  17. cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
  18. set(CMAKE_USE_RELATIVE_PATHS OFF)
  19. set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
  20. # Dependencies
  21. set(QT_MIN_VERSION "5.10.0")
  22. set(KF5_MIN_VERSION "5.56")
  23. set(BLKID_MIN_VERSION "2.33.2")
  24. # Qca-qt5 (tested with botan and ossl backends)
  25. # Runtime
  26. # smartmontools 7.0
  27. # Qca plugin (botan or ossl)
  28. set(VERSION_MAJOR "4")
  29. set(VERSION_MINOR "0")
  30. set(VERSION_RELEASE "0")
  31. set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE})
  32. set(SOVERSION "8")
  33. add_definitions(-D'VERSION="${VERSION}"') #"
  34. set(CMAKE_CXX_STANDARD 14)
  35. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  36. find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
  37. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
  38. include(KDEInstallDirs)
  39. include(KDECMakeSettings)
  40. include(KDECompilerSettings NO_POLICY_SCOPE)
  41. include(FeatureSummary)
  42. include(GenerateExportHeader)
  43. include(ECMSetupVersion)
  44. ecm_setup_version(${VERSION} VARIABLE_PREFIX KPMCORE
  45. VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kpmcore_version.h"
  46. PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfigVersion.cmake"
  47. SOVERSION ${SOVERSION})
  48. find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
  49. Core
  50. DBus
  51. Gui
  52. Widgets
  53. )
  54. # Load the frameworks we need
  55. find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
  56. Auth
  57. CoreAddons
  58. I18n
  59. WidgetsAddons
  60. )
  61. find_package(Qca-qt5 REQUIRED)
  62. # use sane compile flags
  63. add_definitions(
  64. -DQT_USE_QSTRINGBUILDER
  65. -DQT_NO_CAST_TO_ASCII
  66. -DQT_NO_CAST_FROM_ASCII
  67. -DQT_STRICT_ITERATORS
  68. -DQT_NO_URL_CAST_FROM_STRING
  69. -DQT_NO_CAST_FROM_BYTEARRAY
  70. -DQT_NO_CAST_TO_BYTEARRAY
  71. -DQT_NO_SIGNALS_SLOTS_KEYWORDS
  72. -DQT_USE_FAST_OPERATOR_PLUS
  73. )
  74. kde_enable_exceptions()
  75. if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  76. find_package(PkgConfig REQUIRED)
  77. pkg_check_modules(BLKID REQUIRED blkid>=${BLKID_MIN_VERSION})
  78. endif()
  79. include_directories(${Qt5Core_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/)
  80. add_subdirectory(src)
  81. # create a Config.cmake and a ConfigVersion.cmake file and install them
  82. set(INCLUDE_INSTALL_DIR "include/kpmcore/")
  83. set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KPMcore")
  84. configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KPMcoreConfig.cmake.in"
  85. "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfig.cmake"
  86. INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
  87. PATH_VARS INCLUDE_INSTALL_DIR
  88. )
  89. install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfig.cmake"
  90. "${CMAKE_CURRENT_BINARY_DIR}/KPMcoreConfigVersion.cmake"
  91. DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  92. COMPONENT Devel )
  93. install(EXPORT KPMcoreTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KPMcoreTargets.cmake )
  94. ki18n_install(po)
  95. set_target_properties( kpmcore
  96. PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION}
  97. )
  98. message(STATUS "kpmcore ${VERSION} will be built for install into ${CMAKE_INSTALL_PREFIX}")
  99. feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
  100. enable_testing()
  101. add_subdirectory(test)