aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2021-02-13 23:31:27 +0200
committerLasse Collin <lasse.collin@tukaani.org>2021-02-13 23:31:27 +0200
commite7da44d5151e21f153925781ad29334ae0786101 (patch)
tree7f0525d526a0e5308963fc909d13c2f37fbeef6f /CMakeLists.txt
parentCMake: Try to improve compatibility with the FindLibLZMA module. (diff)
downloadxz-e7da44d5151e21f153925781ad29334ae0786101.tar.xz
CMake: Use interface library for better FindLibLZMA compatibility.
https://www.mail-archive.com/xz-devel@tukaani.org/msg00446.html Thanks to Markus Rickert.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47ce5f56..88bec28e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,9 +454,16 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/liblzma-config.cmake"
"include(CMakeFindDependencyMacro)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_dependency(Threads)
+
include(\"\${CMAKE_CURRENT_LIST_DIR}/liblzma-targets.cmake\")
-# Be compatible with the spelling used by the FindLibLZMA module:
-add_library(LibLZMA::LibLZMA ALIAS liblzma::liblzma)
+
+# Be compatible with the spelling used by the FindLibLZMA module. This
+# doesn't use ALIAS because it would make CMake resolve LibLZMA::LibLZMA
+# to liblzma::liblzma instead of keeping the original spelling. Keeping
+# the original spelling is important for good FindLibLZMA compatibility.
+add_library(LibLZMA::LibLZMA INTERFACE IMPORTED)
+set_target_properties(LibLZMA::LibLZMA PROPERTIES
+ INTERFACE_LINK_LIBRARIES liblzma::liblzma)
")
# Set CMAKE_INSTALL_LIBDIR and friends.