-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.cmake
45 lines (36 loc) · 1.73 KB
/
options.cmake
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
message(STATUS "${PROJECT_NAME} CMake ${CMAKE_VERSION} Toolchain ${CMAKE_TOOLCHAIN_FILE}")
cmake_host_system_information(RESULT host_ramMB QUERY TOTAL_PHYSICAL_MEMORY)
cmake_host_system_information(RESULT host_cpu QUERY PROCESSOR_DESCRIPTION)
math(EXPR host_ramGB "${host_ramMB} / 1000")
message(STATUS "${host_ramGB} GB RAM on ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} with ${CMAKE_HOST_SYSTEM_PROCESSOR} ${host_cpu}")
# --- user options
option(BUILD_SHARED_LIBS "Build shared libraries")
option(package "recursively create source and binary packages with CPack")
option(mumps_only "only build MUMPS stack, not other libs")
option(CMAKE_TLS_VERIFY "Verify TLS certs" on)
# --- config checks
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
if(CMAKE_GENERATOR MATCHES "Ninja")
set(suggest Ninja)
elseif(WIN32)
set(suggest "MinGW Makefiles")
else()
set(suggest "Unix Makefiles")
endif()
message(FATAL_ERROR "Please use a single configuration generator like:
cmake -G \"${suggest}\"
")
endif()
# --- CMake Module search path (for Find*.cmake)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
get_filename_component(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} ABSOLUTE)
# file(MAKE_DIRECTORY) doesn't halt execution. We do this to make a useful error message.
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/cmake)
if(NOT IS_DIRECTORY ${CMAKE_INSTALL_PREFIX}/cmake)
message(FATAL_ERROR "Failed to create ${CMAKE_INSTALL_PREFIX}/cmake
Please set CMAKE_INSTALL_PREFIX to a writable location")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}
ensure this is the directory you wish to install libraries to.")
file(GENERATE OUTPUT .gitignore CONTENT "*")