Asking so I can answer this myself, lost a day to it and want to save other folks the trouble.

Setup:

You try something like:

  git clone https://github.com/aws/aws-sdk-cpp.git
  cd aws-sdk-cpp
  mkdir build
  cd build
  cmake ..

You get complaints from cmake ending:

  [...]
  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.

There is a similar line reading 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]

2

There are 2 best solutions below

4
On BEST ANSWER

Completely non-obvious, but the issue appears to be with "cmake 3.19.0-rc1". Changing to cmake 3.18.4 bypassed the issue. I can't tell if this is a cmake issue or an sdk issue, or I'd be posting on somebody's github instead of stackoverflow.

1
On

I had the same issue, and I found out that the CMake that ships with Visual Studio 2019 16.9.1 is broken (version reported as 3.19.20122902-MSVC_2).

I changed the path to CMake to point to that used by Vcpkg, which is version 3.19.2 and now it works just fine.

Therefore I assume the bug is in the CMake that ships with Visual Studio, and was fixed in 3.19.2.