From 32e14907a218ab4223747e7f12b8b904b20d4ea3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 14 Jul 2012 19:09:35 +0200 Subject: [PATCH] add a default value for CMAKE_BUILD_TYPE, resolves error when it is not set --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b561815ca..6c822256f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,13 @@ set (OPENMW_VERSION_RELEASE 0) set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}") +# Add a sensible build type default and warning because empty means no optimization and no debug info. +if(NOT CMAKE_BUILD_TYPE) + message("WARNING: CMAKE_BUILD_TYPE is not defined!\n Defaulting to CMAKE_BUILD_TYPE=RelWithDebInfo. Use ccmake to set a proper value.") + set(CMAKE_BUILD_TYPE RelWithDebInfo + CACHE STRING "Type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) +endif(NOT CMAKE_BUILD_TYPE) + # Debug suffix for plugins set(DEBUG_SUFFIX "") if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")