File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ if (VCPKG_TRIPLET)
2323 set (CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR } /vcpkg_installed/${VCPKG_TRIPLET} " )
2424 message (STATUS "Use CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH } " )
2525 set (PROTOC_PATH "${CMAKE_PREFIX_PATH } /tools/protobuf/protoc" )
26+ if (MSVC AND VCPKG_TRIPLET MATCHES ".*-static" )
27+ # vcpkg installs host executables (protoc, etc.) in the non-static triplet's
28+ # tools directory. Derive it by stripping "-static" from the triplet name.
29+ string (REPLACE "-static" "" VCPKG_HOST_TRIPLET "${VCPKG_TRIPLET} " )
30+ set (PROTOC_PATH "${PROJECT_SOURCE_DIR } /vcpkg_installed/${VCPKG_HOST_TRIPLET} /tools/protobuf/protoc" )
31+ # Set the cache variable so protobuf's CMake module compatibility shim finds it
32+ set (Protobuf_PROTOC_EXECUTABLE "${PROTOC_PATH} .exe" CACHE FILEPATH "protoc executable" FORCE )
33+ endif ()
2634 message (STATUS "Use protoc: ${PROTOC_PATH} " )
2735 set (VCPKG_ROOT "${PROJECT_SOURCE_DIR } /vcpkg_installed/${VCPKG_TRIPLET} " )
2836 set (VCPKG_DEBUG_ROOT "${VCPKG_ROOT} /debug" )
You can’t perform that action at this time.
0 commit comments