vcpkg/ports/msgpack/portfile.cmake
Jack·Boos·Yu 43c6e295a0
[many ports]switch to vcpkg-cmake / vckg-cmake-config part 4 (#29884)
* [many ports]switch to vcpkg-cmake / vckg-cmake-config part 4

* version

* typo

* version

* typo

* version

* Remove PREFER_NINJA

* version

* deprecated vcpkg_extract_source_archive_ex

* version

* fix argument

* version

* More rename

* version

---------

Co-authored-by: jyu49 <yu_jack@apple.com>
2023-03-01 10:39:14 -08:00

38 lines
1.2 KiB
CMake

if (EXISTS ${CURRENT_INSTALLED_DIR}/include/msgpack/pack.h)
message(FATAL_ERROR "Cannot install ${PORT} when rest-rpc is already installed, please remove rest-rpc using \"./vcpkg remove rest-rpc:${TARGET_TRIPLET}\"")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO msgpack/msgpack-c
REF cpp-3.3.0
SHA512 33ed87b23d776cadcc230666e6435088e402c5813e7e4dce5ce79c8c3aceba5a36db8f395278042c6ac44c474b33018ff1635889d8b20bc41c5f6f1d1c963cae
HEAD_REF master
)
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_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DMSGPACK_ENABLE_SHARED=${MSGPACK_ENABLE_SHARED}
-DMSGPACK_ENABLE_STATIC=${MSGPACK_ENABLE_STATIC}
-DMSGPACK_BUILD_EXAMPLES=OFF
-DMSGPACK_BUILD_TESTS=OFF)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/msgpack)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_fixup_pkgconfig()