diff options
author | Filipe Cabecinhas <me@filcab.net> | 2013-04-19 00:19:04 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2013-04-19 00:19:04 +0000 |
commit | 86981e5b716a846e72460fcbd7aed784a8a234e4 (patch) | |
tree | 8febabb41f0f683cccadc45af4b8d6c4968eaf4c /CMakeLists.txt | |
parent | 6aa1c2ce5e2b1ffb1441652e0a376239271913ef (diff) | |
download | lldb-86981e5b716a846e72460fcbd7aed784a8a234e4.tar.gz |
Split Linux-specific and OS X specific stuff. Add include_directories
Only add the -std=c++11 flag when needed, don't touch current flags.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e91c375c5..84b8cf528 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,14 +83,32 @@ include_directories(/usr/include/python2.7) include_directories(../clang/include)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
-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")
+# lldb requires c++11 to build. Make sure that we have a compiler and standard
+# library combination that can do that.
+if (MSVC11)
+ # Do nothing, we're good.
+elseif (NOT MSVC)
+ # gcc and clang require the -std=c++0x or -std=c++11 flag.
+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
+ "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+ if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
+ "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+0x" OR
+ "${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11" OR
+ "${CMAKE_CXX_FLAGS}" MATCHES "-std=gnu\\+\\+11"))
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ endif()
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ endif()
+ endif()
endif()
else()
- set(CMAKE_CXX_FLAGS "-std=c++11")
+ message(FATAL_ERROR "The selected compiler does not support c++11 which is "
+ "required to build lldb.")
endif()
# Disable Clang warnings
@@ -152,7 +170,9 @@ macro(add_lldb_library name) #endif()
if(LLDB_USED_LIBS)
- target_link_libraries(${name} -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+ target_link_libraries(${name} -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+ endif()
endif()
target_link_libraries(${name} ${CLANG_USED_LIBS})
target_link_libraries(${name} ${LLVM_USED_LIBS})
|