CMake: Properly include zstd include directories
This commit is contained in:
parent
498c06b85a
commit
048f6fac52
|
@ -0,0 +1,10 @@
|
||||||
|
# like add_library(new ALIAS old) but avoids add_library cannot create ALIAS target "new" because target "old" is imported but not globally visible. on older cmake
|
||||||
|
# This can be replaced with a direct alias call once our minimum is cmake 3.18
|
||||||
|
function(dolphin_alias_library new old)
|
||||||
|
string(REPLACE "::" "" library_no_namespace ${old})
|
||||||
|
if (NOT TARGET _alias_${library_no_namespace})
|
||||||
|
add_library(_alias_${library_no_namespace} INTERFACE)
|
||||||
|
target_link_libraries(_alias_${library_no_namespace} INTERFACE ${old})
|
||||||
|
endif()
|
||||||
|
add_library(${new} ALIAS _alias_${library_no_namespace})
|
||||||
|
endfunction()
|
|
@ -127,6 +127,7 @@ include(CheckCCompilerFlag)
|
||||||
include(CheckVendoringApproved)
|
include(CheckVendoringApproved)
|
||||||
include(DolphinCompileDefinitions)
|
include(DolphinCompileDefinitions)
|
||||||
include(DolphinDisableWarningsMSVC)
|
include(DolphinDisableWarningsMSVC)
|
||||||
|
include(DolphinLibraryTools)
|
||||||
include(RemoveCompileFlag)
|
include(RemoveCompileFlag)
|
||||||
|
|
||||||
# Enable folders for IDE
|
# Enable folders for IDE
|
||||||
|
@ -773,17 +774,13 @@ else()
|
||||||
add_subdirectory(Externals/liblzma)
|
add_subdirectory(Externals/liblzma)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
pkg_check_modules(ZSTD QUIET libzstd>=1.4.0)
|
pkg_check_modules(ZSTD QUIET libzstd>=1.4.0 IMPORTED_TARGET)
|
||||||
check_include_file(zstd.h HAVE_ZSTD_H)
|
if(ZSTD_FOUND)
|
||||||
if(ZSTD_FOUND AND HAVE_ZSTD_H)
|
|
||||||
message(STATUS "Using shared zstd version: " ${ZSTD_VERSION})
|
message(STATUS "Using shared zstd version: " ${ZSTD_VERSION})
|
||||||
|
dolphin_alias_library(zstd::zstd PkgConfig::ZSTD)
|
||||||
else()
|
else()
|
||||||
check_vendoring_approved(zstd)
|
check_vendoring_approved(zstd)
|
||||||
if(ZSTD_FOUND AND NOT HAVE_ZSTD_H)
|
message(STATUS "Shared zstd not found, falling back to the static library")
|
||||||
message(STATUS "Shared zstd found but lacks headers, falling back to the static library")
|
|
||||||
else()
|
|
||||||
message(STATUS "Shared zstd not found, falling back to the static library")
|
|
||||||
endif()
|
|
||||||
add_subdirectory(Externals/zstd)
|
add_subdirectory(Externals/zstd)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ PUBLIC
|
||||||
core
|
core
|
||||||
BZip2::BZip2
|
BZip2::BZip2
|
||||||
lzma
|
lzma
|
||||||
zstd
|
zstd::zstd
|
||||||
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
|
|
Loading…
Reference in New Issue