Debian Codegraph @

cmake/CPackSetup.cmake

raw
1 # Distributed under the original FontForge BSD 3-clause license
2
3 #[=======================================================================[.rst:
4 CPackSetup
5 ----------
6
7 ``setup_cpack`` sets up CPack. This currently means it sets it up to
8 create the desired source archive. It also creates the dist target.
9
10 This could probably be extended to provide things like Deb/RPMs
11 directly, but that is left for another time.
12
13 #]=======================================================================]
14
15 function(setup_cpack)
16 set(CPACK_GENERATOR "TXZ")
17 set(CPACK_SOURCE_GENERATOR "TXZ")
18 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}")
19 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
20 set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION})
21 set(CPACK_PACKAGE_VERSION_MINOR 0)
22 set(CPACK_PACKAGE_VERSION_PATCH 0)
23 set(CPACK_SOURCE_IGNORE_FILES
24 # Version control:
25 "/\\\\.git/"
26 "\\\\.swp$"
27 "\\\\.#"
28 "/#"
29 "/\\\\.gitignore$"
30 "/\\\\.gitattributes$"
31
32 # Development & Runtime created files
33 "~$"
34 "\\\\.mode"
35 "\\\\.pbxuser$"
36 "\\\\.perspective"
37 "\\\\.pyc$"
38 "\\\\.pyo$"
39 "/cmake-build/"
40 "/build/"
41
42 # System trash
43 "/\\\\.DS_Store"
44 "/\\\\._"
45 "/\\\\.Spotlight-V100$"
46 "/\\\\.Trashes$"
47 "/ethumbs.db$"
48 "/Thumbs.db$"
49 )
50 # CPACK_SOURCE_INSTALLED_DIRECTORIES won't work because the files we want to include
51 # can be in an ignored directory (build/). So use a script instead
52 set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/CPackExtraDist.cmake")
53 configure_file("${PROJECT_SOURCE_DIR}/cmake/scripts/ExtraDist.cmake.in" "CPackExtraDist.cmake" @ONLY)
54 include(CPack)
55 add_custom_target(dist
56 COMMAND "${CMAKE_COMMAND}" --build "${PROJECT_BINARY_DIR}" --target package_source
57 DEPENDS test_dependencies
58 VERBATIM
59 USES_TERMINAL
60 )
61 endfunction()