[Lldb-commits] [lldb] edadb81 - [lldb/CMake] Only auto-enable Lua when SWIG is found
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 8 14:02:58 PST 2020
Author: Jonas Devlieghere
Date: 2020-01-08T14:02:47-08:00
New Revision: edadb818e5be005fa4397b7e4bd5e397ddb4f5d6
URL: https://github.com/llvm/llvm-project/commit/edadb818e5be005fa4397b7e4bd5e397ddb4f5d6
DIFF: https://github.com/llvm/llvm-project/commit/edadb818e5be005fa4397b7e4bd5e397ddb4f5d6.diff
LOG: [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.
Added:
lldb/cmake/modules/FindLuaAndSwig.cmake
Modified:
lldb/cmake/modules/LLDBConfig.cmake
Removed:
################################################################################
diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake
new file mode 100644
index 000000000000..2e99933a7456
--- /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 c4ec7fd7cd9b..4a15a343ee1d 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)
More information about the lldb-commits
mailing list