由于 install(EXPORT "foo-targets" ...) 在导出集中多次包含目标 "foo",aws-cpp-sdk 在 Windows 构建期间失败

jdo*_*ell 3 c++ cmake visual-studio aws-sdk-cpp

问这样我可以自己回答这个问题,为此浪费了一天,并希望为其他人省去麻烦。

设置:

你尝试这样的事情:

  git clone https://github.com/aws/aws-sdk-cpp.git
  cd aws-sdk-cpp
  mkdir build
  cd build
  cmake ..
Run Code Online (Sandbox Code Playgroud)

您收到来自 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.
Run Code Online (Sandbox Code Playgroud)

有一个类似的行读 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]

jdo*_*ell 7

完全不明显,但问题似乎与“cmake 3.19.0-rc1”有关。更改为 cmake 3.18.4 绕过了该问题。我不知道这是 cmake 问题还是 sdk 问题,或者我会在某人的 github 上而不是 stackoverflow 上发帖。