vcpkg/ports/nng/portfile.cmake

59 lines
1.6 KiB
CMake
Raw Normal View History

2018-08-29 21:01:06 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nanomsg/nng
REF 53ae1a5ab37fdfc9ad5c236df3eaf4dd63f0fee9
SHA512 f5532c0b0287df52ddae173dc92eff06d1f4b2b42a2f7afaf28a7736bf70618ae29ccd51fb9743795a8004918a2a2f55233e6ced58829561c745eafa6118b762
2018-08-29 21:01:06 +08:00
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" NNG_STATIC_LIB)
2018-08-31 18:18:10 +08:00
if("mbedtls" IN_LIST FEATURES)
set(NNG_ENABLE_TLS ON)
else()
set(NNG_ENABLE_TLS OFF)
endif()
2018-08-29 21:01:06 +08:00
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE
-DNNG_STATIC_LIB=${NNG_STATIC_LIB}
-DNNG_TESTS=OFF
-DNNG_ENABLE_NNGCAT=OFF
2018-08-31 18:18:10 +08:00
-DNNG_ENABLE_TLS=${NNG_ENABLE_TLS}
2018-08-29 21:01:06 +08:00
)
vcpkg_install_cmake()
# Move CMake config files to the right place
2018-11-17 09:42:31 +08:00
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/nng)
2018-08-29 21:01:06 +08:00
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
2019-03-05 02:23:14 +08:00
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/include/nng/nng.h
"defined(NNG_SHARED_LIB)"
"0 /* defined(NNG_SHARED_LIB) */"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/include/nng/nng.h
"!defined(NNG_STATIC_LIB)"
"1 /* !defined(NNG_STATIC_LIB) */"
)
else()
vcpkg_replace_string(
${CURRENT_PACKAGES_DIR}/include/nng/nng.h
"!defined(NNG_STATIC_LIB)"
"0 /* !defined(NNG_STATIC_LIB) */"
)
endif()
2018-08-29 21:01:06 +08:00
# Put the licence file where vcpkg expects it
configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
2018-08-29 21:01:06 +08:00
vcpkg_copy_pdbs()