[lldb-dev] CMake build script not work with gcc 4.6

comicfans44 comicfans44 at gmail.com
Sun Mar 17 17:51:12 PDT 2013


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")
+
+
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+    set(CMAKE_CXX_FLAGS "-std=c++0x")
+else()
+    set(CMAKE_CXX_FLAGS "-std=c++11")
+endif()
 
 # Disable MSVC warnings
 if( MSVC )


本邮件附件清单如下:
  (1) gcc4.6-cmake.patch (0.5 K)


comicfans44,comicfans44 at gmail.com
2013-3-18 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130318/a9068cac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc4.6-cmake.patch
Type: application/octet-stream
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130318/a9068cac/attachment.obj>


More information about the lldb-dev mailing list