vcpkg/ports/lz4/portfile.cmake
Stefano Sinigardi 69e86fd201 [lz4, flann] port patches from #5169 (#6294)
* [lz4, flann] port patches from #5169

* [lz4] use vcpkg_fixup_cmake_targets

* [flann] improve target handling

* [lz4] remove unnecessary debug message

* [openmvg] many many fixes to build it on windows

* [pcl] use official FLANN cmake config file instead of custom module

* [pcl] fix patch for flann targets

* [pcl] Bump CONTROL version
2019-05-18 22:58:03 -07:00

40 lines
1.2 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lz4/lz4
REF v1.9.1
SHA512 536cdeb6dd73b4769cf9501ad312b004ab01699758534b47ca2eddbc815fd374a3caba40cde36f73a7a70e134065836b733e2b0c023c31740b877ef9317ccf3e
HEAD_REF dev
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d
)
vcpkg_install_cmake()
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}")
else()
string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "0" LZ4_HEADER "${LZ4_HEADER}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/${FILE} "${LZ4_HEADER}")
endforeach()
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)