File: cpack_install_script.cmake

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (81 lines) | stat: -rw-r--r-- 2,682 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Custom CPack install script that allows us to whitelist files to be copied
# to the tarball from the root directory, instead of copying the entire root
# directory recursively

if(CPACK_SOURCE_INSTALLED_DIRECTORIES)
    # Make sure that the parser sources are built
    execute_process(
        COMMAND "${CMAKE_COMMAND}"
        --build "${CPACK_PACKAGE_DIRECTORY}"
        --target parsersources
        RESULT_VARIABLE EXIT_CODE
    )
    if(NOT EXIT_CODE EQUAL 0)
        message(FATAL_ERROR "Failed to build the parser sources.")
    endif()

    # Generate a version file in the build folder if we don't have one in the
    # source folder
    if(EXISTS "${SOURCE_DIR}/IGRAPH_VERSION")
        set(IGRAPH_VERSION_FILE "${SOURCE_DIR}/IGRAPH_VERSION")
    else()
        execute_process(
            COMMAND "${CMAKE_COMMAND}"
            --build "${CPACK_PACKAGE_DIRECTORY}"
            --target versionfile
            RESULT_VARIABLE EXIT_CODE
        )
        if(NOT EXIT_CODE EQUAL 0)
            message(FATAL_ERROR "Failed to determine the version number of igraph that is being packaged.")
        endif()
        set(IGRAPH_VERSION_FILE "${CPACK_PACKAGE_DIRECTORY}/IGRAPH_VERSION")
    endif()

    list(GET CPACK_BUILD_SOURCE_DIRS 0 SOURCE_DIR)
    # This branch runs only if CPack generates the source package, and within
    # this branch, CMAKE_CURRENT_BINARY_DIR refers to the root of the staging
    # area where the tarball is assembled
    file(GLOB FILES_TO_COPY "${SOURCE_DIR}/*.md")
    file(
        INSTALL ${FILES_TO_COPY}
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
    )
    file(
        INSTALL
        "${SOURCE_DIR}/AUTHORS"
        "${SOURCE_DIR}/CMakeLists.txt"
        "${SOURCE_DIR}/COPYING"
        "${SOURCE_DIR}/ChangeLog"
        "${SOURCE_DIR}/INSTALL"
        "${SOURCE_DIR}/NEWS"
        "${SOURCE_DIR}/ONEWS"
        "${SOURCE_DIR}/igraph.pc.in"
        "${IGRAPH_VERSION_FILE}"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
    )
    file(
        INSTALL
        "${SOURCE_DIR}/src/config.h.in"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/src"
    )
    file(
        INSTALL
        "${CPACK_PACKAGE_DIRECTORY}/src/io/parsers"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/src/io"
    )
    file(
        INSTALL
        "${SOURCE_DIR}/tools/removeexamples.py"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/tools"
    )
    file(
        INSTALL
        "${SOURCE_DIR}/tools/strip_licenses_from_examples.py"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/tools"
    )
    file(
        INSTALL
        "${CPACK_PACKAGE_DIRECTORY}/doc/html"
        DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc"
    )
endif()