[PATCH] D17398: [CMake] Properly set CMAKE_BUILD_TYPE to Debug by default

Derek Bruening via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 10:22:44 PST 2016


bruening created this revision.
bruening added reviewers: beanz, rnk.
bruening added a subscriber: llvm-commits.

PR26666: CMAKE_BUILD_TYPE was previously being reset to blank.
By setting it after project() we ensure that it is not blank.

http://reviews.llvm.org/D17398

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -2,11 +2,6 @@
 
 cmake_minimum_required(VERSION 2.8.12.2)
 
-if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  message(STATUS "No build type selected, default to Debug")
-  set(CMAKE_BUILD_TYPE "Debug")
-endif()
-
 if(POLICY CMP0022)
   cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
 endif()
@@ -56,6 +51,12 @@
   ${cmake_3_0_LANGUAGES}
   C CXX ASM)
 
+# PR26666: project() resets CMAKE_BUILD_TYPE so we must set it afterward:
+if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "No build type selected, default to Debug")
+  set(CMAKE_BUILD_TYPE "Debug")
+endif()
+
 # The following only works with the Ninja generator in CMake >= 3.0.
 set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
   "Define the maximum number of concurrent compilation jobs.")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17398.48353.patch
Type: text/x-patch
Size: 941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160218/64bd1a78/attachment.bin>


More information about the llvm-commits mailing list