From bd2932aab90e32c9a81f083d7d4ae66833b8ee9e Mon Sep 17 00:00:00 2001 From: Phoebe <20694052+PhoebeHui@users.noreply.github.com> Date: Mon, 28 Sep 2020 08:36:08 +0800 Subject: [PATCH] [protobuf] Add vcpkg-cmake-wrapper.cmake (#13659) * [opencv] Fix dependency port protobuf * Add vcpkg-cmake-wrapper.cmake for protobuf * Remove blank line * Set the cmake_policy --- ports/protobuf/CONTROL | 2 +- ports/protobuf/portfile.cmake | 4 +++- ports/protobuf/vcpkg-cmake-wrapper.cmake | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 ports/protobuf/vcpkg-cmake-wrapper.cmake diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index ecacb7c28a..115b306c55 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,6 +1,6 @@ Source: protobuf Version: 3.13.0 -Port-Version: 1 +Port-Version: 2 Homepage: https://github.com/protocolbuffers/protobuf Description: Protocol Buffers - Google's data interchange format diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index ab2578f747..47510b5504 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -124,7 +124,6 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") ) endif() -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_copy_pdbs() set(packages protobuf protobuf-lite) foreach(_package IN LISTS packages) @@ -138,3 +137,6 @@ if(NOT VCPKG_TARGET_IS_WINDOWS) set(SYSTEM_LIBRARIES SYSTEM_LIBRARIES pthread) endif() vcpkg_fixup_pkgconfig(${SYSTEM_LIBRARIES}) + +configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/protobuf/vcpkg-cmake-wrapper.cmake b/ports/protobuf/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000000..1a0f683d24 --- /dev/null +++ b/ports/protobuf/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,13 @@ +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3) + cmake_policy(PUSH) + cmake_policy(SET CMP0057 NEW) + if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS) + if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + set(Protobuf_USE_STATIC_LIBS ON) + else() + set(Protobuf_USE_STATIC_LIBS OFF) + endif() + endif() + cmake_policy(POP) +endif() +_find_package(${ARGS})