From 9364df1c6d6d4661b6c32278268ccbe1640a082c Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Fri, 2 Mar 2018 13:50:23 -0600 Subject: Fix CMake build type if none was specified to be cached Restrict CMAKE_BUILD_TYPE to default ones --- config/cmake_ext_mod/HDFMacros.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 4097ca9..bdc52b9 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -27,8 +27,12 @@ macro (SET_HDF_BUILD_TYPE) set(HDF_BUILD_TYPE "Release") endif() endif() - if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + set(CMAKE_BUILD_TYPE RelWithDebInfo 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() endmacro () -- cgit v0.12