CMake build script not work with gcc 4.6

LLDB offical build help page said that gcc>=4.6.2 is supported ,and should set CXXFLAGS=-std=c++0x
bug CMake build script set CXX_FLAGS to -std=c++11 ,which gcc 4.6 does not understand.I suggest a
patch ,just simply set -std=c++0x when compiler is gcc, which makes gcc 4.6 works all right. I did not
add gcc version check because it requires gcc -version output parse,which is not very stable across
different build-config

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5a28ea…2837a8d 100644
— a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,7 +82,14 @@ endmacro(add_lldb_definitions)
include_directories(/usr/include/python2.7)
include_directories(…/clang/include)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/…/clang/include")
-set(CMAKE_CXX_FLAGS “-std=c++11”)

gcc4.6-cmake.patch (557 Bytes)

CMake isn't my area but I found starting with CMake 2.8.8 there is support for compiler version. This would mean you have to use CMake 2.8.8 or greater. I believe -std=c++11 is preferred for gcc 4.7+.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5a28ea..7187af7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,7 +82,14 @@ endmacro(add_lldb_definitions)
include_directories(/usr/include/python2.7)
include_directories(../clang/include)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
-set(CMAKE_CXX_FLAGS "-std=c++11")

I have tried this patch with lldb git version d3a8d6565ff40fd99533f50a085ace806a9300ee,
compiled by both version 4.6.3 and 4.7.2 ,this flag works as expected.

comicfans44,comicfans44@gmail.com
2013-3-21