]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Allow creating debug builds with CMake 1405/head
authorAntoine Pitrou <antoine@python.org>
Tue, 6 Nov 2018 20:24:29 +0000 (21:24 +0100)
committerAntoine Pitrou <antoine@python.org>
Tue, 6 Nov 2018 20:24:29 +0000 (21:24 +0100)
Only set the build type to Release if the user didn't select any.
See discussion in https://github.com/facebook/zstd/pull/1278#issuecomment-436327923
and below.

build/cmake/CMakeLists.txt

index 1e2921de87a483faf99006a59256714b910f6e48..56ae67bbff0d2fe6b835618fd8df636a8bf11ffd 100644 (file)
@@ -7,12 +7,15 @@
 # in the COPYING file in the root directory of this source tree).
 # ################################################################
 
-PROJECT(zstd)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
+
+PROJECT(zstd)
 SET(ZSTD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
 
-# Ensure Release build even if not invoked via Makefile
-SET(CMAKE_BUILD_TYPE "Release")
+if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "No build type selected, defaulting to Release")
+  set(CMAKE_BUILD_TYPE "Release")
+endif()
 
 LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
 INCLUDE(GNUInstallDirs)