-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
36 lines (30 loc) · 1.06 KB
/
install
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
#-------------------------------------------------------------
# This script assumes it is executed from CMAKE_SOURCE_DIR.
# In other words, from the root of the main project.
#-------------------------------------------------------------
# Set GENERATOR variable
if(NOT DEFINED GENERATOR)
set(GENERATOR "-DCMAKE_GENERATOR=Ninja")
else()
set(GENERATOR "-DCMAKE_GENERATOR=${GENERATOR}")
endif()
# Set BUILD_TYPE variable
if(NOT DEFINED BUILD_TYPE)
set(BUILD_TYPE "-DCMAKE_BUILD_TYPE=Release")
else()
set(BUILD_TYPE "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}")
endif()
# Set BUILD_PATH variable
if(NOT DEFINED BUILD_PATH)
set(BUILD_PATH build)
endif()
# Set PREFIX variable
if(NOT DEFINED PREFIX)
set(PREFIX "")
else()
set(PREFIX "-DCMAKE_INSTALL_PREFIX=${PREFIX}")
endif()
# Configure the building and installation of the project
execute_process(COMMAND ${CMAKE_COMMAND} -S ${CMAKE_SOURCE_DIR} -B ${BUILD_PATH} ${GENERATOR} ${BUILD_TYPE} ${PREFIX})
# Build and install the library
execute_process(COMMAND ${CMAKE_COMMAND} --build ${BUILD_PATH} --target install)