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: unassignedb...@nondot.org
          Reporter: bruen...@google.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to