[PATCH] D124153: [CMake] Change default CMAKE_BUILD_TYPE to Release

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 02:44:57 PDT 2022


thieta updated this revision to Diff 426006.
thieta added a comment.

Make omitting CMAKE_BUILD_TYPE an error.

Link will be updated when the updated documentation is merged.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124153/new/

https://reviews.llvm.org/D124153

Files:
  llvm/CMakeLists.txt
  llvm/docs/ReleaseNotes.rst


Index: llvm/docs/ReleaseNotes.rst
===================================================================
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -69,6 +69,10 @@
 Changes to building LLVM
 ------------------------
 
+* Omitting CMAKE_BUILD_TYPE when using a single configuration generator is now
+  an error. You now have to pass -DCMAKE_BUILD_TYPE=<type> in order to configure
+  LLVM.
+
 Changes to TableGen
 -------------------
 
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -64,8 +64,16 @@
 endif()
 
 if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  message(STATUS "No build type selected, default to Debug")
-  set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE)
+  message(FATAL_ERROR "
+No build type selected. You need to pass -DCMAKE_BUILD_TYPE=<type> in order to configure LLVM.
+Available options are:
+  * -DCMAKE_BUILD_TYPE=Release - For optimized build with no assertions or debug info.
+  * -DCMAKE_BUILD_TYPE=Debug - For unoptimized build with assertions and debug info.
+  * -DCMAKE_BUILD_TYPE=RelWithDebInfo - For optimized build with no assertions but with debug info.
+  * -DCMAKE_BUILD_TYPE=MinSizeRel - Build optimized for size instead of speed.
+Learn more about these options and which value is right for your use case in our documentation:
+https://llvm.org/docs/CMake.html
+")
 endif()
 
 # Side-by-side subprojects layout: automatically set the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124153.426006.patch
Type: text/x-patch
Size: 1535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220429/0b8a5dc6/attachment.bin>


More information about the llvm-commits mailing list