mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
CMake: Protects against double find_package
Boost iostream uses `find_package` in quiet mode and then again uses `find_package` with required. This second call triggers a `add_library cannot create imported target "ZLIB::ZLIB" because another target with the same name already exists.` This can simply be fixed by skipping the alias part on secondary `find_package` runs.
This commit is contained in:
parent
045d7aae28
commit
0d94ba6922
1 changed files with 9 additions and 7 deletions
|
@ -889,6 +889,7 @@ write_basic_package_version_file(
|
|||
set(LZMA_CONFIG_CONTENTS
|
||||
"include(\"\${CMAKE_CURRENT_LIST_DIR}/liblzma-targets.cmake\")
|
||||
|
||||
if(NOT TARGET 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
|
||||
|
@ -896,6 +897,7 @@ set(LZMA_CONFIG_CONTENTS
|
|||
add_library(LibLZMA::LibLZMA INTERFACE IMPORTED)
|
||||
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES liblzma::liblzma)
|
||||
endif()
|
||||
")
|
||||
|
||||
if(ENABLE_THREADS STREQUAL "posix")
|
||||
|
|
Loading…
Reference in a new issue