pineapple-src/externals/vcpkg/ports/lz4/portfile.cmake
2022-07-23 03:01:36 +02:00

40 lines
1.2 KiB
CMake
Executable file

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)