diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index cc745c82..1891304b 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -59,7 +59,7 @@ vcpkg_cmake_install() vcpkg_copy_pdbs() # https://cmake.org/cmake/help/latest/module/FindProtobuf.html -vcpkg_cmake_config_fixup(PACKAGE_NAME Protobuf CONFIG_PATH lib/cmake) +vcpkg_cmake_config_fixup(PACKAGE_NAME protobuf CONFIG_PATH lib/cmake) vcpkg_fixup_pkgconfig() if(BUILD_PROTOC) @@ -75,12 +75,17 @@ if(BUILD_PROTOC) endforeach() vcpkg_copy_tools(TOOL_NAMES ${PROTOC_NAMES} AUTO_CLEAN) - # protoc executable must be correct version. NO_DEFAULT_PATH + # copied from vcpkg upstream: protoc executable must be correct version. NO_DEFAULT_PATH configure_file( "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY ) +else() + # copied from vcpkg upstream: create protobuf::protoc with the host installed executable + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/protobuf-targets-vcpkg-protoc.cmake" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" + ) endif() file(REMOVE_RECURSE diff --git a/ports/protobuf/protobuf-targets-vcpkg-protoc.cmake b/ports/protobuf/protobuf-targets-vcpkg-protoc.cmake new file mode 100644 index 00000000..149e6587 --- /dev/null +++ b/ports/protobuf/protobuf-targets-vcpkg-protoc.cmake @@ -0,0 +1,8 @@ +# Create imported target protobuf::protoc +add_executable(protobuf::protoc IMPORTED) + +# Import target "protobuf::protoc" for configuration "Release" +set_property(TARGET protobuf::protoc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(protobuf::protoc PROPERTIES + IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_EXECUTABLE}" +) diff --git a/ports/protobuf/vcpkg-cmake-wrapper.cmake b/ports/protobuf/vcpkg-cmake-wrapper.cmake index 07259d22..f77e0f9d 100644 --- a/ports/protobuf/vcpkg-cmake-wrapper.cmake +++ b/ports/protobuf/vcpkg-cmake-wrapper.cmake @@ -1,4 +1,3 @@ find_program(Protobuf_PROTOC_EXECUTABLE NAMES protoc PATHS "${CMAKE_CURRENT_LIST_DIR}/../../../@HOST_TRIPLET@/tools/protobuf" NO_DEFAULT_PATH) -message(STATUS "Found protoc: ${Protobuf_PROTOC_EXECUTABLE}") _find_package(${ARGS}) diff --git a/versions/p-/protobuf.json b/versions/p-/protobuf.json index bbaa5b16..2e79ce80 100644 --- a/versions/p-/protobuf.json +++ b/versions/p-/protobuf.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "b4f896ca595e7c38ec74a200f28a12a4648b26d0", + "git-tree": "b9417f19fe38ea5c5dd8a79bc69ed7efee1adb72", "version": "4.25.5", "port-version": 0 }