[lz4] Fix for building Linux shared libraries (#10452)

* [lz4] Fix for building Linux shared libraries

* [lz4] Changes requested by maintainer
This commit is contained in:
here-mikelley 2020-04-16 13:42:29 -07:00 committed by GitHub
parent d216948042
commit f68088b9ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)
project(lz4 C)
if(BUILD_SHARED_LIBS)
if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DLZ4_DLL_EXPORT)
endif()
add_definitions(-DXXH_NAMESPACE=LZ4_)

View File

@ -1,5 +1,5 @@
Source: lz4
Version: 1.9.2
Version: 1.9.2-1
Homepage: https://github.com/lz4/lz4
Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.
Build-Depends: xxhash
Build-Depends: xxhash

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lz4/lz4
@ -23,7 +21,7 @@ vcpkg_copy_pdbs()
foreach(FILE lz4.h lz4frame.h)
file(READ ${CURRENT_PACKAGES_DIR}/include/${FILE} LZ4_HEADER)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "1" LZ4_HEADER "${LZ4_HEADER}")
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "1 && defined(_MSC_VER)" LZ4_HEADER "${LZ4_HEADER}")
else()
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "0" LZ4_HEADER "${LZ4_HEADER}")
endif()
@ -34,6 +32,4 @@ vcpkg_fixup_cmake_targets()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(COPY ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lz4)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/lz4/LICENSE ${CURRENT_PACKAGES_DIR}/share/lz4/copyright)
file(INSTALL ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)