Add support for lldb-3.9 (dotnet/coreclr#9190)
authorFrederik Carlier <frederik.carlier@quamotion.mobi>
Mon, 30 Jan 2017 10:53:45 +0000 (11:53 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Mon, 30 Jan 2017 10:53:45 +0000 (11:53 +0100)
Commit migrated from https://github.com/dotnet/coreclr/commit/4c06f08661d351a3a960bfbabc9b426a3c4c0db1

src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt

index 8ae2c9b..6b3bad1 100644 (file)
@@ -49,13 +49,13 @@ if(NOT ENABLE_LLDBPLUGIN)
 endif()
 
 # Check for LLDB library
-find_library(LLDB NAMES LLDB lldb lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
-find_library(LLDB NAMES LLDB lldb lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
+find_library(LLDB NAMES LLDB lldb lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
+find_library(LLDB NAMES LLDB lldb lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
 if(LLDB STREQUAL LLDB-NOTFOUND)
     if(REQUIRE_LLDBPLUGIN)
-        message(FATAL_ERROR "Cannot find lldb-3.5, lldb-3.6 or lldb-3.8. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
+        message(FATAL_ERROR "Cannot find lldb-3.5, lldb-3.6, lldb-3.8 or lldb-3.9. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
     else()
-        message(WARNING "Cannot find lldb-3.5,lldb-3.6 or lldb-3.8. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
+        message(WARNING "Cannot find lldb-3.5,lldb-3.6, lldb-3.8 or lldb-3.9. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
     endif()
     return()
 endif()
@@ -63,28 +63,24 @@ endif()
 message(STATUS "LLDB: ${LLDB}")
 
 # Check for LLDB headers
-
+# Multiple versions of LLDB can install side-by-side, so we need to check for lldb in various locations.
+# If the file in a directory is found the result is stored in the variable and the search will not be repeated unless the variable is cleared.
 find_path(LLDB_H "lldb/API/LLDB.h" PATHS "${WITH_LLDB_INCLUDES}" NO_DEFAULT_PATH)
 find_path(LLDB_H "lldb/API/LLDB.h")
+
+find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.9/include")
+find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.8/include")
+find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.7/include")
+find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.6/include")
+find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
+
 if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
-    find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.8/include")
-    if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
-               find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.7/include")
-       if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
-                       find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.6/include")
-                       if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
-                               find_path(LLDB_H "lldb/API/LLDB.h" PATHS "/usr/lib/llvm-3.5/include")
-                               if(LLDB_H STREQUAL LLDB_H-NOTFOUND)
-                                       if(REQUIRE_LLDBPLUGIN)
-                                               message(FATAL_ERROR "Cannot find LLDB.h. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
-                                       else()
-                                               message(WARNING "Cannot find LLDB.h Try installing lldb-3.6-dev (or the appropriate package for your platform)")
-                                       endif()
-                                       return()
-                               endif()
-                       endif()
-               endif()
+    if(REQUIRE_LLDBPLUGIN)
+        message(FATAL_ERROR "Cannot find LLDB.h. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
+    else()
+        message(WARNING "Cannot find LLDB.h Try installing lldb-3.6-dev (or the appropriate package for your platform)")
     endif()
+    return()
 endif()
 
 message(STATUS "LLDB_H: ${LLDB_H}")