]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Improve setting the default build type 1474/head
authorHans Johnson <hans.j.johnson@gmail.com>
Mon, 24 Dec 2018 14:48:04 +0000 (08:48 -0600)
committerHans Johnson <hans.j.johnson@gmail.com>
Wed, 26 Dec 2018 19:23:21 +0000 (13:23 -0600)
The CMAKE_BUILD_TYPE variable is a CACHE variable
and should be set in a way that persists and is
documented in the CACHE.  Also set the default
values for the gui to ease selection of types.

These changes provide better support for GUI
configurators that support cmake.

build/cmake/CMakeLists.txt

index c9dab0d5dbc1dafbd3395f8a0643dcdfc8826e05..d0f943b5841c6819f0158214a2e92a9bf49da93f 100644 (file)
@@ -12,9 +12,12 @@ cmake_minimum_required(VERSION 2.8.9)
 project(zstd)
 set(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
 
-if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  message(STATUS "No build type selected, defaulting to Release")
-  set(CMAKE_BUILD_TYPE "Release")
+# Set a default build type if none was specified
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "Setting build type to 'Release' as none was specified.")
+  set(CMAKE_BUILD_TYPE Release 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()
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")