blob: c4dbba728bb2516c0487933f33928db7e7d1b715 (
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
34
35
36
|
# 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_cmd NAMES cmd.exe REQUIRED)
# cmd scans its whole command line for switches, so C:/Windows/System32/cmd.exe would read "/cmd.exe" as /c.
file(TO_NATIVE_PATH "${cpsc_cmd}" cpsc_cmd_native)
file(TO_NATIVE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/install.cmd" cpsc_installer)
# An explicit "call" keeps cmd's handling of the quoted script path the same on CMake 3.x and 4.x.
execute_process(
COMMAND "${cpsc_cmd_native}" /d /c call "${cpsc_installer}"
--source-dir "@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()
|