CMakeLists.txt 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. # === This file is part of Calamares - <https://github.com/calamares> ===
  2. #
  3. # Calamares is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # Calamares is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with Calamares. If not, see <http://www.gnu.org/licenses/>.
  15. #
  16. # SPDX-License-Identifier: GPL-3.0+
  17. # License-Filename: LICENSE
  18. #
  19. ###
  20. #
  21. # Generally, this CMakeLists.txt will find all the dependencies for Calamares
  22. # and complain appropriately. See below (later in this file) for CMake-level
  23. # options. There are some "secret" options as well:
  24. #
  25. # SKIP_MODULES : a space or semicolon-separated list of directory names
  26. # under src/modules that should not be built.
  27. # USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>
  28. # BUILD_<foo> : choose additional things to build
  29. # DEBUG_<foo> : special developer flags for debugging
  30. #
  31. # Example usage:
  32. #
  33. # cmake . -DSKIP_MODULES="partition luksbootkeycfg"
  34. #
  35. # One special target is "show-version", which can be built
  36. # to obtain the version number from here.
  37. cmake_minimum_required( VERSION 3.2 FATAL_ERROR )
  38. project( CALAMARES
  39. VERSION 3.2.10
  40. LANGUAGES C CXX )
  41. set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development
  42. ### OPTIONS
  43. #
  44. option( INSTALL_CONFIG "Install configuration files" OFF )
  45. option( INSTALL_POLKIT "Install Polkit configuration" ON )
  46. option( BUILD_TESTING "Build the testing tree." ON )
  47. option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
  48. option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF )
  49. option( WITH_KF5Crash "Enable crash reporting with KCrash." ON )
  50. ### USE_*
  51. #
  52. # By convention, when there are multiple modules that implement similar
  53. # functionality, and it only makes sense to have **at most one** of them
  54. # enabled at any time, those modules are named <foo>-<implementation>.
  55. # For example, services-systemd and services-openrc.
  56. #
  57. # Setting up SKIP_MODULES to ignore "the ones you don't want" can be
  58. # annoying and error-prone (e.g. if a new module shows up). The USE_*
  59. # modules provide a way to do automatic selection. To pick exactly
  60. # one of the implementations from group <foo>, set USE_<foo> to the
  61. # name of the implementation. If USE_<foo> is unset, or empty, then
  62. # all the implementations are enabled (this just means they are
  63. # **available** to `settings.conf`, not that they are used).
  64. #
  65. # Currently, only USE_services is in use (to pick only one of the two
  66. # modules, systemd or openrc).
  67. set( USE_services "" CACHE STRING "Select the services module to use" )
  68. ### Calamares application info
  69. #
  70. set( CALAMARES_ORGANIZATION_NAME "Calamares" )
  71. set( CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares" )
  72. set( CALAMARES_APPLICATION_NAME "Calamares" )
  73. set( CALAMARES_DESCRIPTION_SUMMARY
  74. "The distribution-independent installer framework" )
  75. ### Transifex (languages) info
  76. #
  77. # complete = 100% translated,
  78. # good = nearly complete (use own judgement, right now >= 75%)
  79. # ok = incomplete (more than 25% untranslated, at least 5% translated),
  80. # incomplete = <5% translated, placeholder in tx; these are not included.
  81. #
  82. # Language en (source language) is added later. It isn't listed in
  83. # Transifex either. Get the list of languages and their status
  84. # from https://transifex.com/calamares/calamares/ , or (preferably)
  85. # use ci/txstats.py to automatically check.
  86. #
  87. # When adding a new language, take care that it is properly loaded
  88. # by the translation framework. Languages with alternate scripts
  89. # (sr@latin in particular) may need special handling in CalamaresUtils.cpp.
  90. #
  91. # TODO: drop the es_ES translation from Transifex
  92. # TODO: move eo (Esperanto) to _ok once Qt can actually create a
  93. # locale for it.
  94. #
  95. # NOTE: when updating the list from Transifex, copy these four lines
  96. # and prefix each variable name with "p", so that the automatic
  97. # checks for new languages and misspelled ones are done (that is,
  98. # copy these four lines to four backup lines, add "p", and then update
  99. # the original four lines with the current translations).
  100. set( _tx_complete ca cs_CZ da de fr he hr hu ko lt pt_BR sq tr_TR
  101. zh_TW )
  102. set( _tx_good ast en_GB es es_MX et fi_FI gl id it_IT ja nl pl
  103. pt_PT ro ru sk zh_CN )
  104. set( _tx_ok ar bg el es_PR eu hi is mr nb sl sr sr@latin sv th
  105. uk )
  106. set( _tx_incomplete be ca@valencia eo fa fr_CH gu kk kn lo mk ne_NP ur uz )
  107. ### Required versions
  108. #
  109. # See DEPENDENCIES section below.
  110. set( QT_VERSION 5.9.0 )
  111. set( YAMLCPP_VERSION 0.5.1 )
  112. set( ECM_VERSION 5.18 )
  113. set( PYTHONLIBS_VERSION 3.3 )
  114. set( BOOSTPYTHON_VERSION 1.55.0 )
  115. ### CMAKE SETUP
  116. #
  117. set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" )
  118. # CMake 3.9, 3.10 compatibility
  119. if( POLICY CMP0071 )
  120. cmake_policy( SET CMP0071 NEW )
  121. endif()
  122. if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
  123. list(APPEND CMAKE_AUTOMOC_MACRO_NAMES
  124. "K_PLUGIN_FACTORY_WITH_JSON"
  125. "K_EXPORT_PLASMA_DATAENGINE_WITH_JSON"
  126. "K_EXPORT_PLASMA_RUNNER"
  127. )
  128. endif()
  129. ### C++ SETUP
  130. #
  131. set( CMAKE_CXX_STANDARD 14 )
  132. set( CMAKE_CXX_STANDARD_REQUIRED ON )
  133. set( CMAKE_C_STANDARD 99 )
  134. set( CMAKE_C_STANDARD_REQUIRED ON )
  135. # Debugging flags
  136. #
  137. # Possible debugging flags are:
  138. # - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
  139. # widget and enables chatty debug logging, for dealing with the timezone
  140. # location database.
  141. # - DEBUG_FILESYSTEMS does extra logging and checking when looking at
  142. # partition configuration. Lists known KPMCore FS types.
  143. #
  144. # The flags listed here are enabled in Debug builds. By default, none
  145. # are **actually** listed, because they're for such specific scenarios.
  146. set( _enable_debug_flags
  147. # DEBUG_TIMEZONES
  148. # DEBUG_FILESYSTEMS
  149. )
  150. # Add those flags to the CXX flags in a suitable format.
  151. foreach( _edf ${_enable_debug_flags} )
  152. string( APPEND CMAKE_CXX_FLAGS_DEBUG " -D${_edf}" )
  153. endforeach()
  154. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
  155. if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
  156. message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." )
  157. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
  158. set( CMAKE_C_FLAGS_DEBUG "-g" )
  159. set( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
  160. set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
  161. set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
  162. # Clang warnings: doing *everything* is counter-productive, since it warns
  163. # about things which we can't fix (e.g. C++98 incompatibilities, but
  164. # Calamares is C++14).
  165. foreach( CLANG_WARNINGS
  166. -Weverything
  167. -Wno-c++98-compat
  168. -Wno-c++98-compat-pedantic
  169. -Wno-padded
  170. -Wno-undefined-reinterpret-cast
  171. -Wno-global-constructors
  172. -Wno-exit-time-destructors
  173. -Wno-missing-prototypes
  174. -Wno-documentation-unknown-command
  175. -Wno-unknown-warning-option
  176. )
  177. string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
  178. endforeach()
  179. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='//'" )
  180. # Third-party code where we don't care so much about compiler warnings
  181. # (because it's uncomfortable to patch) get different flags; use
  182. # mark_thirdparty_code( <file> [<file>...] )
  183. # to switch off warnings for those sources.
  184. set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" )
  185. set( SUPPRESS_BOOST_WARNINGS " -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion" )
  186. set( CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}" )
  187. set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
  188. set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" )
  189. set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" )
  190. set( CMAKE_TOOLCHAIN_PREFIX "llvm-" )
  191. set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
  192. set( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" )
  193. set( CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h )
  194. else()
  195. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
  196. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" )
  197. set( SUPPRESS_3RDPARTY_WARNINGS "" )
  198. set( SUPPRESS_BOOST_WARNINGS "" )
  199. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTREACHED='__builtin_unreachable();'" )
  200. endif()
  201. # Use mark_thirdparty_code() to reduce warnings from the compiler
  202. # on code that we're not going to fix. Call this with a list of files.
  203. macro(mark_thirdparty_code)
  204. set_source_files_properties( ${ARGV}
  205. PROPERTIES
  206. COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}"
  207. COMPILE_DEFINITIONS "THIRDPARTY"
  208. )
  209. endmacro()
  210. if( CMAKE_COMPILER_IS_GNUCXX )
  211. if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR
  212. CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9 )
  213. message( STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages." )
  214. set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto" )
  215. endif()
  216. endif()
  217. include( FeatureSummary )
  218. include( CMakeColors )
  219. ### DEPENDENCIES
  220. #
  221. find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui Widgets LinguistTools Svg Quick QuickWidgets )
  222. find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED )
  223. if( INSTALL_POLKIT )
  224. find_package( PolkitQt5-1 REQUIRED )
  225. else()
  226. # Find it anyway, for dependencies-reporting
  227. find_package( PolkitQt5-1 )
  228. endif()
  229. set_package_properties(
  230. PolkitQt5-1 PROPERTIES
  231. DESCRIPTION "Qt5 support for Polkit"
  232. URL "https://cgit.kde.org/polkit-qt-1.git"
  233. PURPOSE "PolkitQt5-1 helps with installing Polkit configuration"
  234. )
  235. # Find ECM once, and add it to the module search path; Calamares
  236. # modules that need ECM can do
  237. # find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE),
  238. # no need to mess with the module path after.
  239. find_package(ECM ${ECM_VERSION} NO_MODULE)
  240. if( ECM_FOUND )
  241. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
  242. if ( BUILD_TESTING )
  243. # ECM implies that we can build the tests, too
  244. find_package( Qt5 COMPONENTS Test REQUIRED )
  245. include( ECMAddTests )
  246. endif()
  247. include(KDEInstallDirs)
  248. endif()
  249. find_package( KF5 COMPONENTS CoreAddons Crash )
  250. if( NOT KF5Crash_FOUND )
  251. set( WITH_KF5Crash OFF )
  252. endif()
  253. if( BUILD_TESTING )
  254. enable_testing()
  255. endif ()
  256. find_package( PythonLibs ${PYTHONLIBS_VERSION} )
  257. set_package_properties(
  258. PythonLibs PROPERTIES
  259. DESCRIPTION "C interface libraries for the Python 3 interpreter."
  260. URL "http://python.org"
  261. PURPOSE "Python 3 is used for Python job modules."
  262. )
  263. if ( PYTHONLIBS_FOUND )
  264. include( BoostPython3 )
  265. find_boost_python3( ${BOOSTPYTHON_VERSION} ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND )
  266. set_package_properties(
  267. Boost PROPERTIES
  268. PURPOSE "Boost.Python is used for Python job modules."
  269. )
  270. find_package( PythonQt )
  271. set_package_properties( PythonQt PROPERTIES
  272. DESCRIPTION "A Python embedding solution for Qt applications."
  273. URL "http://pythonqt.sourceforge.net"
  274. PURPOSE "PythonQt is used for Python view modules."
  275. )
  276. endif()
  277. if( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND )
  278. message(STATUS "Disabling Boost::Python modules")
  279. set( WITH_PYTHON OFF )
  280. endif()
  281. if( NOT PYTHONLIBS_FOUND OR NOT PYTHONQT_FOUND )
  282. message(STATUS "Disabling PythonQt modules")
  283. set( WITH_PYTHONQT OFF )
  284. endif()
  285. ### Transifex Translation status
  286. #
  287. # Construct language lists for use. If there are p_tx* variables,
  288. # then run an extra cmake-time check for consistency of the old
  289. # (p_tx*) and new (_tx*) lists.
  290. #
  291. set( prev_tx ${p_tx_complete} ${p_tx_good} ${p_tx_ok} ${p_tx_incomplete} )
  292. set( curr_tx ${_tx_complete} ${_tx_good} ${_tx_ok} ${_tx_incomplete} )
  293. set( tx_errors OFF )
  294. if ( prev_tx )
  295. # Gone in new list
  296. foreach( l ${prev_tx} )
  297. list( FIND curr_tx ${l} p_l )
  298. if( p_l EQUAL -1 )
  299. message(WARNING "Language ${l} was present in previous translations and is now absent.")
  300. set( tx_errors ON )
  301. endif()
  302. endforeach()
  303. # New in list
  304. foreach( l ${curr_tx} )
  305. list( FIND prev_tx ${l} p_l )
  306. if( p_l EQUAL -1 )
  307. message(WARNING "Language ${l} is new.")
  308. set( tx_errors ON )
  309. endif()
  310. set( p_l "lang/calamares_${l}.ts" )
  311. if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${p_l} )
  312. message(WARNING "Language ${l} has no .ts file yet.")
  313. set( tx_errors ON )
  314. endif()
  315. endforeach()
  316. unset( p_l )
  317. unset( l )
  318. endif()
  319. unset( prev_tx )
  320. unset( curr_tx )
  321. if( tx_errors )
  322. message( FATAL_ERROR "Translation warnings, see above." )
  323. endif()
  324. set( CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok} )
  325. list( SORT CALAMARES_TRANSLATION_LANGUAGES )
  326. add_subdirectory( lang ) # i18n tools
  327. ### Example Distro
  328. #
  329. # For testing purposes Calamares includes a very, very, limited sample
  330. # distro called "Generic". The root filesystem of "Generic" lives in
  331. # data/example-root and can be squashed up as part of the build, so
  332. # that a pure-upstream run of ./calamares -d from the build directory
  333. # (with all the default settings and configurations) can actually
  334. # do an complete example run.
  335. #
  336. # Some binaries from the build host (e.g. /bin and /lib) are also
  337. # squashed into the example filesystem.
  338. #
  339. # To build the example distro (for use by the default, example,
  340. # unsquashfs module), build the target 'example-distro', eg.:
  341. #
  342. # make example-distro
  343. #
  344. find_program( mksquashfs_PROGRAM mksquashfs )
  345. if( mksquashfs_PROGRAM )
  346. set( mksquashfs_FOUND ON )
  347. set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ )
  348. set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs )
  349. if( EXISTS ${src_fs} )
  350. # based on the build host. If /lib64 exists, assume it is needed.
  351. # Collect directories needed for a minimal binary distro,
  352. # Note that the last path component is added to the root, so
  353. # if you add /usr/sbin here, it will be put into /sbin_1.
  354. # Add such paths to /etc/profile under ${src_fs}.
  355. set( candidate_fs /sbin /bin /lib /lib64 )
  356. set( host_fs "" )
  357. foreach( c_fs ${candidate_fs} )
  358. if( EXISTS ${c_fs} )
  359. list( APPEND host_fs ${c_fs} )
  360. endif()
  361. endforeach()
  362. add_custom_command(
  363. OUTPUT ${dst_fs}
  364. COMMAND ${mksquashfs_PROGRAM} ${src_fs} ${dst_fs} -all-root
  365. COMMAND ${mksquashfs_PROGRAM} ${host_fs} ${dst_fs} -all-root
  366. )
  367. add_custom_target(example-distro DEPENDS ${dst_fs})
  368. endif()
  369. else()
  370. set( mksquashfs_FOUND OFF )
  371. endif()
  372. # Doesn't list mksquashfs as an optional dep, though, because it
  373. # hasn't been sent through the find_package() scheme.
  374. #
  375. # "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html"
  376. add_feature_info( ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.")
  377. ### CALAMARES PROPER
  378. #
  379. set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
  380. set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" )
  381. if( CALAMARES_VERSION_RC )
  382. set( CALAMARES_VERSION ${CALAMARES_VERSION}rc${CALAMARES_VERSION_RC} )
  383. endif()
  384. # additional info for non-release builds
  385. if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" )
  386. include( CMakeDateStamp )
  387. set( CALAMARES_VERSION_DATE "${CMAKE_DATESTAMP_YEAR}${CMAKE_DATESTAMP_MONTH}${CMAKE_DATESTAMP_DAY}" )
  388. if( CALAMARES_VERSION_DATE GREATER 0 )
  389. set( CALAMARES_VERSION ${CALAMARES_VERSION}.${CALAMARES_VERSION_DATE} )
  390. endif()
  391. include( CMakeVersionSource )
  392. if( CMAKE_VERSION_SOURCE )
  393. set( CALAMARES_VERSION ${CALAMARES_VERSION}-${CMAKE_VERSION_SOURCE} )
  394. endif()
  395. endif()
  396. # Special target for not-RC (e.g. might-be-release) builds.
  397. # This is used by the release script to get the version.
  398. if ( CALAMARES_VERSION_RC EQUAL 0 )
  399. add_custom_target(show-version
  400. ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT}
  401. USES_TERMINAL
  402. )
  403. endif()
  404. # enforce using constBegin, constEnd for const-iterators
  405. add_definitions( "-DQT_STRICT_ITERATORS" )
  406. # set paths
  407. set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
  408. set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
  409. set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
  410. # Better default installation paths: GNUInstallDirs defines
  411. # CMAKE_INSTALL_FULL_SYSCONFDIR to be CMAKE_INSTALL_PREFIX/etc by default
  412. # but we really want /etc
  413. if( NOT DEFINED CMAKE_INSTALL_SYSCONFDIR )
  414. set( CMAKE_INSTALL_SYSCONFDIR "/etc" )
  415. endif()
  416. # make predefined install dirs available everywhere
  417. include( GNUInstallDirs )
  418. # make uninstall support
  419. configure_file(
  420. "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  421. "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  422. IMMEDIATE @ONLY
  423. )
  424. # Early configure these files as we need them later on
  425. set( CALAMARES_CMAKE_DIR "${CMAKE_SOURCE_DIR}/CMakeModules" )
  426. set( CALAMARES_LIBRARIES calamares )
  427. add_subdirectory( src )
  428. add_feature_info(Python ${WITH_PYTHON} "Python job modules")
  429. add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules")
  430. add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
  431. add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
  432. # Add all targets to the build-tree export set
  433. set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
  434. set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
  435. export( TARGETS calamares
  436. FILE "${PROJECT_BINARY_DIR}/CalamaresLibraryDepends.cmake" )
  437. # Export the package for use from the build-tree
  438. # (this registers the build-tree with a global CMake-registry)
  439. export( PACKAGE Calamares )
  440. # Create a CalamaresBuildTreeSettings.cmake file for the use from the build tree
  441. configure_file( CalamaresBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CalamaresBuildTreeSettings.cmake" @ONLY )
  442. # Create the CalamaresConfig.cmake and CalamaresConfigVersion files
  443. file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" )
  444. configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY )
  445. configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY )
  446. configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY )
  447. # Install the cmake files
  448. install(
  449. FILES
  450. "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
  451. "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake"
  452. "${PROJECT_BINARY_DIR}/CalamaresUse.cmake"
  453. "CMakeModules/CalamaresAddPlugin.cmake"
  454. "CMakeModules/CalamaresAddModuleSubdirectory.cmake"
  455. "CMakeModules/CalamaresAddLibrary.cmake"
  456. "CMakeModules/CalamaresAddBrandingSubdirectory.cmake"
  457. "CMakeModules/CalamaresAddTranslations.cmake"
  458. "CMakeModules/CalamaresAutomoc.cmake"
  459. "CMakeModules/CMakeColors.cmake"
  460. DESTINATION
  461. "${CMAKE_INSTALL_CMAKEDIR}"
  462. )
  463. # Install the export set for use with the install-tree
  464. install(
  465. EXPORT
  466. CalamaresLibraryDepends
  467. DESTINATION
  468. "${CMAKE_INSTALL_CMAKEDIR}"
  469. )
  470. if( INSTALL_CONFIG )
  471. install(
  472. FILES
  473. settings.conf
  474. DESTINATION
  475. share/calamares
  476. )
  477. endif()
  478. if( INSTALL_POLKIT )
  479. install(
  480. FILES
  481. com.github.calamares.calamares.policy
  482. DESTINATION
  483. "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
  484. )
  485. endif()
  486. install(
  487. FILES
  488. calamares.desktop
  489. DESTINATION
  490. ${CMAKE_INSTALL_DATADIR}/applications
  491. )
  492. install(
  493. FILES
  494. man/calamares.8
  495. DESTINATION
  496. ${CMAKE_INSTALL_MANDIR}/man8/
  497. )
  498. # uninstall target
  499. configure_file(
  500. "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  501. "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  502. IMMEDIATE @ONLY
  503. )
  504. add_custom_target( uninstall
  505. COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
  506. )
  507. ### CMAKE SUMMARY REPORT
  508. #
  509. feature_summary(WHAT ALL)
  510. get_directory_property( SKIPPED_MODULES
  511. DIRECTORY src/modules
  512. DEFINITION LIST_SKIPPED_MODULES
  513. )
  514. calamares_explain_skipped_modules( ${SKIPPED_MODULES} )