[PATCH] D129651: Try to simplify cmake files using variables set by find_package

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 08:37:03 PDT 2022


thakis created this revision.
thakis added a reviewer: hans.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.

No intended behavior change.

See https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1043
for some background. (LLVM requires CMake 3.13, so we are guaranteed
to have that change.)


https://reviews.llvm.org/D129651

Files:
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/WindowsManifest/CMakeLists.txt


Index: llvm/lib/WindowsManifest/CMakeLists.txt
===================================================================
--- llvm/lib/WindowsManifest/CMakeLists.txt
+++ llvm/lib/WindowsManifest/CMakeLists.txt
@@ -1,7 +1,7 @@
 include(GetLibraryName)
 
 if(LLVM_ENABLE_LIBXML2)
-  set(imported_libs LibXml2::LibXml2)
+  set(imported_libs "${LIBXML2_LIBRARIES}")
 endif()
 
 add_llvm_component_library(LLVMWindowsManifest
@@ -21,14 +21,6 @@
 # This block is only needed for llvm-config. When we deprecate llvm-config and
 # move to using CMake export, this block can be removed.
 if(LLVM_ENABLE_LIBXML2)
-  # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
-  if(CMAKE_BUILD_TYPE)
-    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
-    get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type})
-  endif()
-  if(NOT libxml2_library)
-    get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION)
-  endif()
-  get_library_name(${libxml2_library} libxml2_library)
-  set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library})
+  get_library_name(${LIBXML2_LIBRARY} libxml2_library_name)
+  set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library_name})
 endif()
Index: llvm/lib/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -277,16 +277,8 @@
 # This block is only needed for llvm-config. When we deprecate llvm-config and
 # move to using CMake export, this block can be removed.
 if(LLVM_ENABLE_ZLIB)
-  # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
-  if(CMAKE_BUILD_TYPE)
-    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
-    get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
-  endif()
-  if(NOT zlib_library)
-    get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
-  endif()
-  get_library_name(${zlib_library} zlib_library)
-  set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
+  get_library_name(${ZLIB_LIBRARY} zlib_library_name)
+  set(llvm_system_libs ${llvm_system_libs} "${zlib_library_name}")
 endif()
 
 if(LLVM_ENABLE_TERMINFO)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129651.444275.patch
Type: text/x-patch
Size: 2257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220713/9de790c3/attachment.bin>


More information about the llvm-commits mailing list