[Lldb-commits] [lldb] r179821 - Split Linux-specific and OS X specific stuff. Add include_directories

Filipe Cabecinhas me at filcab.net
Thu Apr 18 17:19:04 PDT 2013


Author: filcab
Date: Thu Apr 18 19:19:04 2013
New Revision: 179821

URL: http://llvm.org/viewvc/llvm-project?rev=179821&view=rev
Log:
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.

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=179821&r1=179820&r2=179821&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Apr 18 19:19:04 2013
@@ -83,14 +83,32 @@ include_directories(/usr/include/python2
 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})

Modified: lldb/trunk/source/Plugins/Process/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/CMakeLists.txt?rev=179821&r1=179820&r2=179821&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/CMakeLists.txt Thu Apr 18 19:19:04 2013
@@ -1,7 +1,13 @@
-#add_subdirectory(FreeBSD)
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+  add_subdirectory(Linux)
+  add_subdirectory(POSIX)
+elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  #add_subdirectory(FreeBSD)
+  add_subdirectory(POSIX)
+elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(MacOSX-Kernel)
+endif()
+
 add_subdirectory(gdb-remote)
-add_subdirectory(Linux)
-#add_subdirectory(mach-core)
-#add_subdirectory(MacOSx-Kernel)
-add_subdirectory(POSIX)
 add_subdirectory(Utility)
+add_subdirectory(mach-core)

Modified: lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt?rev=179821&r1=179820&r2=179821&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt Thu Apr 18 19:19:04 2013
@@ -1,3 +1,5 @@
+include_directories(../../../Utility/)
+
 set(LLVM_NO_RTTI 1)
 
 add_lldb_library(lldbPluginProcessUtility
@@ -16,4 +18,4 @@ add_lldb_library(lldbPluginProcessUtilit
   ThreadMemory.cpp
   UnwindLLDB.cpp
   UnwindMacOSXFrameBackchain.cpp
-  )
\ No newline at end of file
+  )

Modified: lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt?rev=179821&r1=179820&r2=179821&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/CMakeLists.txt Thu Apr 18 19:19:04 2013
@@ -1,3 +1,5 @@
+include_directories(../Utility)
+
 set(LLVM_NO_RTTI 1)
 
 add_lldb_library(lldbPluginProcessMachCore





More information about the lldb-commits mailing list