vcpkg/ports/czmq/portfile.cmake
myd7349 0ab1a9e1c6
[vcpkg] Add new function vcpkg_copy_tools (#8749)
* [vcpkg] Add new function vcpkg_copy_tools

* [cpuinfo][czmq][nanomsg][uriparser] Use vcpkg_copy_tools

* [czmq] Clean even tools are not copied

[libsvm][zyre] Use vcpkg_copy_tools

* [vcpkg-copy-tools] Clean debug/bin

This should fix czmq build error

* [czmq] czmq does not have BUILD_TOOLS option

* [vcpkg] Split clean logic into another function

* [cpuinfo][czmq][nanomsg][uriparser] Fix calling of vcpkg_copy_tools

* [zyre] Fix regression error

* [vcpkg] Update try_remove_empty_directory

* [libsvm] Fix vcpkg_copy_tools call
2020-05-01 15:28:55 -07:00

85 lines
2.2 KiB
CMake

include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO zeromq/czmq
REF 7e29cf95305551daad197e32423d9cff5f9b6893
SHA512 7d79494c904f5276c9d1e4a193a63882dc622a6db8998b9719de4aec8b223b3a8b3c92ea02be81f39afc12c1a883b310fd3662ea27ed736b0b9c7092b4843a18
HEAD_REF master
PATCHES
fix-dependencies.patch
)
foreach(_cmake_module
Findlibcurl.cmake
Findlibmicrohttpd.cmake
Findlibzmq.cmake
Findlz4.cmake
Finduuid.cmake
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/${_cmake_module}
${SOURCE_PATH}/${_cmake_module}
COPYONLY
)
endforeach()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
draft ENABLE_DRAFTS
curl CZMQ_WITH_LIBCURL
httpd CZMQ_WITH_LIBMICROHTTPD
lz4 CZMQ_WITH_LZ4
uuid CZMQ_WITH_UUID
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DCZMQ_BUILD_SHARED=${BUILD_SHARED}
-DCZMQ_BUILD_STATIC=${BUILD_STATIC}
-DBUILD_TESTING=OFF
${FEATURE_OPTIONS}
)
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/${PORT})
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/${PORT})
endif()
file(COPY
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
)
if ("tool" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES zmakecert)
endif()
vcpkg_clean_executables_in_bin(FILE_NAMES zmakecert)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/czmq_library.h
"if defined CZMQ_STATIC"
"if 1 //if defined CZMQ_STATIC"
)
endif()
# Handle copyright
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
# CMake integration test
vcpkg_test_cmake(PACKAGE_NAME ${PORT})