aboutsummaryrefslogtreecommitdiff
path: root/cmake/Install.cmake.in
blob: c6cd83f30a81f746e9f30031e92cb7e03ba5f120 (plain)
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

# The ordinary build does not require Pandoc; generate the manual on installation.
set(CPSC_LOCAL_BIN_DIRS "@CPSC_LOCAL_BIN_DIRS@")
include("@CPSC_DEPS_MODULE_DIR@/FindDependency.cmake")
execute_process(
    COMMAND "@CMAKE_COMMAND@" --build "@CMAKE_CURRENT_BINARY_DIR@" --target doc
    RESULT_VARIABLE cpsc_doc_result
)
if(NOT cpsc_doc_result STREQUAL "0")
    message(FATAL_ERROR "Cannot build the manual; Pandoc must be available locally or in PATH")
endif()

set(cpsc_install_windows "@WIN32@")
if(cpsc_install_windows)
    cpsc_find_dependency(PROGRAM cpsc_powershell NAMES powershell.exe REQUIRED)
    execute_process(
        COMMAND "${cpsc_powershell}" -NoProfile -NonInteractive -ExecutionPolicy Bypass
            -File "@CMAKE_CURRENT_SOURCE_DIR@/install.ps1"
            -SourceDir "@CMAKE_CURRENT_BINARY_DIR@"
            -Prefix "${CMAKE_INSTALL_PREFIX}"
        RESULT_VARIABLE cpsc_install_result
    )
else()
    cpsc_find_dependency(PROGRAM cpsc_shell NAMES sh bash REQUIRED)
    execute_process(
        COMMAND "${cpsc_shell}" "@CMAKE_CURRENT_SOURCE_DIR@/install.sh"
            --source-dir "@CMAKE_CURRENT_BINARY_DIR@"
            --prefix "${CMAKE_INSTALL_PREFIX}"
        RESULT_VARIABLE cpsc_install_result
    )
endif()
if(NOT cpsc_install_result STREQUAL "0")
    message(FATAL_ERROR "cpsc installation failed (${cpsc_install_result})")
endif()