forked from MartinHelmut/cpp-base-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStandardProjectSettings.cmake
29 lines (24 loc) · 1012 Bytes
/
StandardProjectSettings.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
# 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 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug 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")
endif ()
find_program(CCACHE ccache)
if (CCACHE)
message(STATUS "Using ccache")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
else ()
message(STATUS "Ccache not found")
endif ()
# Generate compile_commands.json to make it easier to work with clang based tools
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(DEACTIVATE_LOGGING "Disable logging" OFF)
if (DEACTIVATE_LOGGING)
add_compile_definitions(APP_DEACTIVATE_LOGGING)
endif ()
option(DEBUG "Enable debug statements and asserts" OFF)
if (DEBUG OR CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(DEBUG APP_ENABLE_ASSERTS APP_PROFILE)
endif ()