windows 上的 vcpkg curl 中的疑似错误

A suspected bug in vcpkg curl on windows

简单地做: vcpkg.exe install curl:x86-windows

然后用 cmake 构建: cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake

会输出:

C:\Users\altffour\Desktop\Projects\ContractNotifier\build>cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
CMake Error at C:/vcpkg/installed/x86-windows/share/curl/vcpkg-cmake-wrapper.cmake:5 (_find_package):
  Could not find a configuration file for package "CURL" that is compatible
  with requested version "".

  The following configuration files were considered but not accepted:

    C:/vcpkg/installed/x86-windows/share/curl/CURLConfig.cmake, version: 7.66.0-DEV (32bit)

CMakeLists:

# curl
find_package(CURL CONFIG REQUIRED)
include_directories(${CURL_INCLUDE_DIR})

file(GLOB_RECURSE hdrs "src/*.h")
file(GLOB_RECURSE srcs "src/*.cpp")
file(GLOB_RECURSE ui "src/*.ui")
include_directories("." "src/")

add_executable(contractNotifier ${ui} ${hdrs} ${srcs})
target_link_libraries(contractNotifier Qt5::Core Qt5::Widgets Boost::serialization ${CMAKE_THREAD_LIBS_INIT} CURL::libcurl)

我发现错误了吗?

这里解决了https://github.com/microsoft/vcpkg/issues/9290

原因:使用传递给 vcpkg 的 :x64-windows 参数编译所有必需的包并使用 -DVCPKG_TARGET_TRIPLET=x64-windows 调用 cmake 编译成功!

希望这对某人有所帮助!

对我来说,事实证明我是不小心为 x86 编译的(有时在 CLion 中是默认的)。更改为 x64 解决了这个问题。