vcpkg/ports/msgpack/portfile.cmake
2019-04-04 21:12:11 -07:00

37 lines
1.2 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO msgpack/msgpack-c
REF cpp-3.1.1
SHA512 2d1607f482160d8860b07d7597af760bfefcb3afa4e82602df43487d15950ab235e7efeabd7e08996807935de71d4dcdab424c91bff806279419db2ec9500227
HEAD_REF master)
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-static-lib-option.patch)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(MSGPACK_ENABLE_SHARED OFF)
set(MSGPACK_ENABLE_STATIC ON)
else()
set(MSGPACK_ENABLE_SHARED ON)
set(MSGPACK_ENABLE_STATIC OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DMSGPACK_ENABLE_SHARED=${MSGPACK_ENABLE_SHARED}
-DMSGPACK_ENABLE_STATIC=${MSGPACK_ENABLE_STATIC}
-DMSGPACK_BUILD_EXAMPLES=OFF
-DMSGPACK_BUILD_TESTS=OFF)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/msgpack)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/msgpack)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/msgpack/COPYING ${CURRENT_PACKAGES_DIR}/share/msgpack/copyright)