问题描述
请我自己回答,迷失了一天,并希望为其他人省去麻烦。
设置:
- Windows(在Windows 10和Server 2019上均可见)
- Visual Studio(在Visual Studio 2017和Visual Studio 2019上均可看到)
- cmake 3.19.0-rc1(本文最新下载)
- 按照https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup.html中有关AWS C ++ SDK的Windows源自构建的说明进行操作。既适用于从源进行标准构建,也适用于
vcpkg
替代方案。如果您尝试手动构建https://github.com/aws/aws-sdk-cpp中提到的“第三方依赖关系”,也会发生这种情况。
您尝试类似的操作:
git clone https://github.com/aws/aws-sdk-cpp.git
cd aws-sdk-cpp
mkdir build
cd build
cmake ..
您会收到来自cmake结尾的投诉:
[...]
Performing configure step for 'AwsChecksums'
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.27.29112.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
CUSTOMBUILD : CMake error : install(EXPORT "aws-checksums-targets" ...) includes target "aws-checksums" more than once in the export set. [C:\Users\xyz\aws-sdk-cpp\build\.deps\AwsChecksums.vcxproj]
-- Generating done
CMake Generate step Failed. Build files cannot be regenerated correctly.
CMake Error at CMakeLists.txt:224 (message):
Failed to build third-party libraries.
类似的一行显示为CUSTOMBUILD : CMake error : install(EXPORT "aws-c-common-targets" ...) includes target "aws-c-common" more than once in the export set. [C:\Users\xyz\aws-sdk-cpp\build\.deps\AwsCCommon.vcxproj]
解决方法
完全不明显,但是问题似乎出在“ cmake 3.19.0-rc1”上。更改为cmake 3.18.4可以绕过此问题。我不知道这是cmake问题还是sdk问题,或者我将发布在某人的github上,而不是stackoverflow。
,我遇到了同样的问题,我发现 Visual Studio 2019 16.9.1 附带的 CMake 已损坏(版本报告为 3.19.20122902-MSVC_2
)。
我将 CMake 的路径更改为指向 Vcpkg 使用的路径,即版本 3.19.2
,现在它可以正常工作了。
因此,我认为该错误存在于 Visual Studio 随附的 CMake 中,并已在 3.19.2 中修复。