diff --git a/ports/zeromq/CONTROL b/ports/zeromq/CONTROL index 85bee72f7a..9d15708747 100644 --- a/ports/zeromq/CONTROL +++ b/ports/zeromq/CONTROL @@ -1,3 +1,7 @@ Source: zeromq Version: 2019-01-30 Description: The ZeroMQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products + +Feature: sodium +Description: Using libsodium for CURVE security +Build-Depends: libsodium diff --git a/ports/zeromq/portfile.cmake b/ports/zeromq/portfile.cmake index 2ceba5e3a8..35875540b4 100644 --- a/ports/zeromq/portfile.cmake +++ b/ports/zeromq/portfile.cmake @@ -14,6 +14,12 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} \"-I${SOURCE_PATH}/builds/msvc\"") set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} \"-I${SOURCE_PATH}/builds/msvc\"") +if("sodium" IN_LIST FEATURES) + set(WITH_LIBSODIUM ON) +else() + set(WITH_LIBSODIUM OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -22,6 +28,7 @@ vcpkg_configure_cmake( -DPOLLER=select -DBUILD_STATIC=${BUILD_STATIC} -DBUILD_SHARED=${BUILD_SHARED} + -DWITH_LIBSODIUM=${WITH_LIBSODIUM} -DWITH_PERF_TOOL=OFF OPTIONS_DEBUG "-DCMAKE_PDB_OUTPUT_DIRECTORY=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" @@ -38,6 +45,13 @@ if(EXISTS ${CURRENT_PACKAGES_DIR}/share/cmake/ZeroMQ) vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/ZeroMQ) endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/zmq.h + "defined ZMQ_STATIC" + "1 //defined ZMQ_STATIC" + ) +endif() + file(READ ${CURRENT_PACKAGES_DIR}/share/zeromq/ZeroMQConfig.cmake _contents) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") string(REPLACE "get_target_property(ZeroMQ_STATIC_LIBRARY libzmq-static LOCATION)" "add_library(libzmq-static INTERFACE IMPORTED)\nset_target_properties(libzmq-static PROPERTIES INTERFACE_LINK_LIBRARIES libzmq)" _contents "${_contents}")