[lldb-dev] CMake build script not work with gcc 4.6
Kopec, Matt
matt.kopec at intel.com
Tue Mar 19 16:05:54 PDT 2013
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")
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
+ set(CMAKE_CXX_FLAGS "-std=c++0x")
+ else()
+ set(CMAKE_CXX_FLAGS "-std=c++11")
+ endif()
+endif()
# Disable MSVC warnings
if( MSVC )
Let me know if this works.
Matt
________________________________
From: lldb-dev-bounces at cs.uiuc.edu [lldb-dev-bounces at cs.uiuc.edu] on behalf of comicfans44 [comicfans44 at gmail.com]
Sent: Sunday, March 17, 2013 8:51 PM
To: lldb-dev
Subject: [lldb-dev] 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")
+
+
+
+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<mailto:comicfans44 at gmail.com>
2013-3-18
More information about the lldb-dev
mailing list