vcpkg/ports/zeromq/portfile.cmake
Victor Romero a3a6530631
[vcpkg_check_features] Set output variable explicitly and allow reverse-logic check (#7558)
* [vcpkg_check_features] Set OUT_EXPAND_OPTIONS explicitly

* [vcpkg_check_features] Allow reverse logic for features

* [vcpkg_check_features] Document new parameters

* [vcpkg_check_features] Remove unnecessary logging

* Do not create variables for each feature only set OUT_FEATURE_OPTIONS

* Improve documentation

* Update ports that use vcpkg_check_features()

* Missing documentation updates

* [pcl] Fix tools feature

* [opencv,opencv4] Fix usage of vcpkg_check_features()

* [opencv4] Fix typo
2019-08-13 20:13:55 -07:00

66 lines
1.9 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO zeromq/libzmq
REF b5db4b4421c8b2766321e70e5e9ca07c197fac47
SHA512 e1166b9eec3c0613c2b085bf995e6d711554ba77e180f7b86aa2d04157f2ab7dca8131b855568f8fc931ac256628f6018e6bc67bc9fbecfd498776b4151d6e63
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
sodium WITH_LIBSODIUM
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DZMQ_BUILD_TESTS=OFF
-DPOLLER=select
-DBUILD_STATIC=${BUILD_STATIC}
-DBUILD_SHARED=${BUILD_SHARED}
-DWITH_PERF_TOOL=OFF
${FEATURE_OPTIONS}
OPTIONS_DEBUG
"-DCMAKE_PDB_OUTPUT_DIRECTORY=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(EXISTS ${CURRENT_PACKAGES_DIR}/CMake)
vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
endif()
if(EXISTS ${CURRENT_PACKAGES_DIR}/share/cmake/ZeroMQ)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/ZeroMQ)
endif()
file(COPY
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/zmq.h
"defined ZMQ_STATIC"
"1 //defined ZMQ_STATIC"
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
# Handle copyright
file(RENAME ${CURRENT_PACKAGES_DIR}/share/zmq/COPYING.LESSER.txt ${CURRENT_PACKAGES_DIR}/share/zeromq/copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/zmq)
# CMake integration test
vcpkg_test_cmake(PACKAGE_NAME ZeroMQ)