[Lldb-commits] [lldb] 64d99cc - [CMake] Move find_package(ZLIB) to LLVMConfig

Petr Hosek via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 27 17:14:08 PDT 2020


Author: Petr Hosek
Date: 2020-07-27T17:13:55-07:00
New Revision: 64d99cc6abed78c00a2a7863b02ce54911a5264f

URL: https://github.com/llvm/llvm-project/commit/64d99cc6abed78c00a2a7863b02ce54911a5264f
DIFF: https://github.com/llvm/llvm-project/commit/64d99cc6abed78c00a2a7863b02ce54911a5264f.diff

LOG: [CMake] Move find_package(ZLIB) to LLVMConfig

This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.

Differential Revision: https://reviews.llvm.org/D84691

Added: 
    

Modified: 
    clang/CMakeLists.txt
    lld/CMakeLists.txt
    lldb/cmake/modules/LLDBStandalone.cmake
    llvm/cmake/modules/LLVMConfig.cmake.in
    mlir/examples/standalone/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1c4c22b1aaad..1a6a20a271f3 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -114,10 +114,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
   option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
 
-  if(LLVM_ENABLE_ZLIB)
-    find_package(ZLIB)
-  endif()
-
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index bcfc2c6270b3..e9bd1bd29c5c 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -51,10 +51,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
 
-  if(LLVM_ENABLE_ZLIB)
-    find_package(ZLIB)
-  endif()
-
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)

diff  --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake
index edd2b34ec865..94781c358374 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -74,10 +74,6 @@ endif()
 # CMake modules to be in that directory as well.
 list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
 
-if(LLVM_ENABLE_ZLIB)
-  find_package(ZLIB)
-endif()
-
 include(AddLLVM)
 include(TableGen)
 include(HandleLLVMOptions)

diff  --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index e729a839f614..17cc5eacc57b 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -50,6 +50,9 @@ set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
 set(LLVM_ENABLE_UNWIND_TABLES @LLVM_ENABLE_UNWIND_TABLES@)
 
 set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@)
+if(LLVM_ENABLE_ZLIB)
+  find_package(ZLIB)
+endif()
 
 set(LLVM_LIBXML2_ENABLED @LLVM_LIBXML2_ENABLED@)
 

diff  --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt
index 59d3c693546f..3f46dda4e4f6 100644
--- a/mlir/examples/standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/CMakeLists.txt
@@ -29,10 +29,6 @@ set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR})
 list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
 
-if(LLVM_ENABLE_ZLIB)
-  find_package(ZLIB)
-endif()
-
 include(TableGen)
 include(AddLLVM)
 include(AddMLIR)


        


More information about the lldb-commits mailing list