diff --git a/CMakeLists.txt b/CMakeLists.txt index e7873a24..a7097a01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,18 @@ option(try_OpenMP "try to use OpenMP if available" ON) set(qt_version AUTO CACHE STRING "provide a specific Qt version to be used.") set_property(CACHE qt_version PROPERTY STRINGS AUTO 3 4 5) +#--- set a default build type if none was specified --------------------------- +set(default_build_type "Release") + +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() + #--- perform some checks and generate the config.h ---------------------------- include(CheckTypeSize) include(CheckIncludeFiles) @@ -218,6 +230,9 @@ message(" -------") message("") message(" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR} - ${CMAKE_HOST_SYSTEM_VERSION}") message("") +message(" Build Type: ${CMAKE_BUILD_TYPE}") +message(" -----------") +message("") message(" Requirements:") message(" -------------") message("")