summaryrefslogtreecommitdiffstats
path: root/Source/Modules/CMakeBuildUtilities.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Modules/CMakeBuildUtilities.cmake')
-rw-r--r--Source/Modules/CMakeBuildUtilities.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake
index dad4bc1..157367f 100644
--- a/Source/Modules/CMakeBuildUtilities.cmake
+++ b/Source/Modules/CMakeBuildUtilities.cmake
@@ -259,12 +259,16 @@ if(CMAKE_USE_SYSTEM_LIBARCHIVE)
if(NOT LibArchive_FOUND)
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
endif()
- set(CMAKE_TAR_INCLUDES ${LibArchive_INCLUDE_DIRS})
- set(CMAKE_TAR_LIBRARIES ${LibArchive_LIBRARIES})
+ # NOTE `FindLibArchive` got imported targets support since 3.17
+ if (NOT TARGET LibArchive::LibArchive)
+ add_library(LibArchive::LibArchive UNKNOWN IMPORTED)
+ set_target_properties(LibArchive::LibArchive PROPERTIES
+ IMPORTED_LOCATION "${LibArchive_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LibArchive_INCLUDE_DIRS}")
+ endif ()
else()
set(EXPAT_INCLUDE_DIR ${CMAKE_EXPAT_INCLUDES})
set(EXPAT_LIBRARY ${CMAKE_EXPAT_LIBRARIES})
- add_compile_definitions(LIBARCHIVE_STATIC)
set(ENABLE_MBEDTLS OFF)
set(ENABLE_NETTLE OFF)
if(DEFINED CMAKE_USE_OPENSSL)
@@ -300,8 +304,9 @@ else()
set(ENABLE_SAFESEH "" CACHE INTERNAL "libarchive: No /SAFESEH linker flag")
set(WINDOWS_VERSION "WIN7" CACHE INTERNAL "libarchive: Set Windows version to use (Windows only)")
add_subdirectory(Utilities/cmlibarchive)
+ add_library(LibArchive::LibArchive ALIAS cmlibarchive)
+ target_compile_definitions(cmlibarchive INTERFACE LIBARCHIVE_STATIC)
CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty")
- set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
endif()
#---------------------------------------------------------------------