blob: bd88a7302feac1bad2caaa0138990178502a6723 (
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
37
38
39
40
41
42
43
44
|
# from here:
# https://github.com/lefticus/cpp_starter_project/blob/master/cmake/StandardProjectSettings.cmake
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE
RelWithDebInfo
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui, ccmake
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo")
endif()
# Generate compile_commands.json to make it easier to work with clang based tools
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(ENABLE_IPO "Enable Interprocedural Optimization, aka Link Time Optimization (LTO)" OFF)
if(ENABLE_IPO)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(SEND_ERROR "IPO is not supported: ${output}")
endif()
endif()
option(VCS_TAG "Read version information from git" ON)
if(VCS_TAG)
find_program(VCS git)
execute_process(COMMAND git describe --abbrev=0 OUTPUT_VARIABLE CMAKE_PROJECT_SHORT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git describe --long --abbrev=40 OUTPUT_VARIABLE CMAKE_PROJECT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
set(CMAKE_PROJECT_SHORT_VERSION ${CMAKE_PROJECT_VERSION})
endif()
|