summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-01-08 14:01:57 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2020-01-08 14:02:47 -0800
commitedadb818e5be005fa4397b7e4bd5e397ddb4f5d6 (patch)
tree16d5963c8b7d64a336472cf20981b13a8aea195d
parent2d258ed931cdf47a7d1dcf08ad963b5452a8670f (diff)
downloadbcm5719-llvm-edadb818e5be005fa4397b7e4bd5e397ddb4f5d6.tar.gz
bcm5719-llvm-edadb818e5be005fa4397b7e4bd5e397ddb4f5d6.zip
[lldb/CMake] Only auto-enable Lua when SWIG is found
Just like Python, Lua should only be auto-enabled if SWIG is found as well. This moves the logic of finding SWIG and Lua as a whole into a new CMake package.
-rw-r--r--lldb/cmake/modules/FindLuaAndSwig.cmake31
-rw-r--r--lldb/cmake/modules/LLDBConfig.cmake2
2 files changed, 32 insertions, 1 deletions
diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
new file mode 100644
index 00000000000..2e99933a745
--- /dev/null
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -0,0 +1,31 @@
+#.rst:
+# FindLuaAndSwig
+# --------------
+#
+# Find Lua and SWIG as a whole.
+
+if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
+ set(LUAANDSWIG_FOUND TRUE)
+else()
+ find_package(SWIG 2.0 QUIET)
+ if (SWIG_FOUND)
+ find_package(Lua QUIET)
+ if(LUA_FOUND AND SWIG_FOUND)
+ mark_as_advanced(
+ LUA_LIBRARIES
+ LUA_INCLUDE_DIR
+ SWIG_EXECUTABLE)
+ endif()
+ else()
+ message(STATUS "SWIG 2 or later is required for Lua support in LLDB but could not be found")
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LuaAndSwig
+ FOUND_VAR
+ LUAANDSWIG_FOUND
+ REQUIRED_VARS
+ LUA_LIBRARIES
+ LUA_INCLUDE_DIR
+ SWIG_EXECUTABLE)
+endif()
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index c4ec7fd7cd9..4a15a343ee1 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -56,7 +56,7 @@ endmacro()
add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
-add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" Lua LUA_FOUND)
+add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)
OpenPOWER on IntegriCloud