[cmake] Add flags for different build types and set default value
Default to RelWithDebInfo (-O2 -g) if no custom CMAKE_BUILD_TYPE is defined. Also add flags for use with CMAKE_BUILD_TYPEs Debug, Release, and RelWithDebInfo.
This commit is contained in:
parent
cda18be6b4
commit
1ab9fe663f
@ -11,6 +11,15 @@ PROJECT(fish)
|
||||
|
||||
# We are C++11.
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||
SET(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
MESSAGE(STATUS "Setting build type to default '${DEFAULT_BUILD_TYPE}'")
|
||||
SET(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
|
||||
ENDIF()
|
||||
|
||||
# Disable exception handling.
|
||||
ADD_COMPILE_OPTIONS(-fno-exceptions)
|
||||
|
Loading…
x
Reference in New Issue
Block a user