vcpkg/ports/lz4/portfile.cmake
Kai Pastor 845a5fda11
[libarchive,lz4] Fix pc file, modernize portfile (#20146)
* Fix pc file

* Modernize portfile

* OpenSSL unused on 'Darwin'

* x-add-version

* More port cleanup (CR requests)

* Revise wrapper, using find_package

* Don't use pkgconfig modules for windows openssl

* Update versions

* Use namespaced variables for custom lzo lookup

* Wrapper needs CMP0012

* Skip dependencies if not LibArchive_FOUND

* Update versions

* Fix liblz4.pc debug lib fixup

* Update versions

Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2021-09-24 12:06:17 -07:00

41 lines
1.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lz4/lz4
REF v1.9.3
SHA512 c246b0bda881ee9399fa1be490fa39f43b291bb1d9db72dba8a85db1a50aad416a97e9b300eee3d2a4203c2bd88bda2762e81bc229c3aa409ad217eb306a454c
HEAD_REF dev
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(DLL_IMPORT "1 && defined(_MSC_VER)")
else()
set(DLL_IMPORT "0")
endif()
foreach(FILE lz4.h lz4frame.h)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${FILE}"
"defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)"
"${DLL_IMPORT}"
)
endforeach()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblz4.pc" " -llz4" " -llz4d")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/lib/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)