default to a RelWithDebInfo build if cmake is invoked without setting CMAKE_BUILD_TYPE

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-08-05 08:20:53 +02:00 committed by eboasson
parent 2a67df48fc
commit 9bd0a519fc

View file

@ -11,6 +11,17 @@
# #
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
FUNCTION(PREPEND var prefix) FUNCTION(PREPEND var prefix)
SET(listVar "") SET(listVar "")
FOREACH(f ${ARGN}) FOREACH(f ${ARGN})