[llvm-bugs] [Bug 26666] New: CMAKE_BUILD_TYPE is blank by default (the current attempt to set to Debug is broken)
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 18 10:11:01 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26666
Bug ID: 26666
Summary: CMAKE_BUILD_TYPE is blank by default (the current
attempt to set to Debug is broken)
Product: Build scripts
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: cmake
Assignee: unassignedbugs at nondot.org
Reporter: bruening at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
When configuring with cmake, the code attempts to set CMAKE_BUILD_TYPE to Debug
if it is not explicitly set. However, this is incorrectly done prior to the
project() command, which clears it out. The result is that CMAKE_BUILD_TYPE is
blank, which leads to a strange build that is something in between Release and
Debug but is missing assertions and much debug info.
The page at http://llvm.org/docs/GettingStarted.html says:
"-DCMAKE_BUILD_TYPE=type — Valid options for type are Debug, Release,
RelWithDebInfo, and MinSizeRel. Default is Debug."
References elsewhere also assume that CMAKE_BUILD_TYPE is never blank: e.g., in
https://llvm.org/bugs/show_bug.cgi?id=23322.
To reproduce, simply compare these two:
# cmake -DCMAKE_BUILD_TYPE=Debug <path-to-sources>
# cmake <path-to-sources>
Notice how only the former sets -D_DEBUG (look in the makefiles or build.ninja
for -GNinja) and enables LLVM_ENABLE_ASSERTIONS, while the latter enables
"-Wl,-O3 -Wl,--gc-sections". The former results in a 22GB build directory
(this is llvm + clang) while the latter is only 4.1GB.
It looks like the code that tries to set a default was added in
http://reviews.llvm.org/D7360 but I do not understand how it ever worked. I
tested with cmake 2.8.10 as well as several other versions and it's always
blanked by project().
The fix is simple: move the current code that sets a blank type down below
project(). I will send a patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160218/b771deb4/attachment.html>
More information about the llvm-bugs
mailing list