[PATCH] Setting up CMake to default to RelWithDebInfo when no build type is specified.

Chris Bieneman beanz at apple.com
Mon Feb 9 16:18:06 PST 2015

I have no objection to making the default Debug rather than RelWithDebInfo. I use RelWithDebInfo primarily because it builds faster, but Debug works too.

The real problem is that the behavior when CMAKE_BUILD_TYPE is the empty string is very inconsistent. The CMAKE_C_FLAGS and CMAKE_CXX_FLAGS variables are empty unless you explicitly set them or the build type, so you actually end up with an unoptimized build with no debug info.

Here's an example compile command from a CMake + Ninja build with no build type set:

  /usr/bin/c++   -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -Ilib/Support -I/Users/cbieneman/dev/open-source/llvm/lib/Support -Iinclude -I/Users/cbieneman/dev/open-source/llvm/include    -fno-exceptions -fno-rtti -MMD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -c /Users/cbieneman/dev/open-source/llvm/lib/Support/Allocator.cpp



More information about the llvm-commits mailing list