首页 > 解决方案 > 无法构建 AWS 开发工具包 CPP 示例。Cmake 找不到 AWSSDKConfig.cmake,但该文件存在于我的磁盘上

问题描述

我使用亚马逊文档中给出的说明在我的 Ubuntu 机器上安装了适用于 C++ 的 AWS 开发工具包:

https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup.html

我能够毫无错误地编译 SDK。

然后我按照 README 为 C++ 构建示例。当我运行 Cmake 时,出现以下错误:

CMake Error at CMakeLists.txt:15 (find_package):
  By not providing "FindAWSSDK.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "AWSSDK", but
  CMake did not find one.

  Could not find a package configuration file provided by "AWSSDK" with any
  of the following names:

    AWSSDKConfig.cmake
    awssdk-config.cmake

  Add the installation prefix of "AWSSDK" to CMAKE_PREFIX_PATH or set
  "AWSSDK_DIR" to a directory containing one of the above files.  If "AWSSDK"
  provides a separate development package or SDK, be sure it has been
  installed.

但是AWSSDKConfig.cmake肯定在我的系统上:

$  locate AWSSDKConfig.cmake
/home/robert/Documents/GitHub/aws-sdk-cpp/cmake/AWSSDKConfig.cmake

所以我尝试使用 CMake CMAKE_PREFIX_PATH 命令行参数直接添加配置文件的路径:

sudo cmake -D CMAKE_PREFIX_PATH="/home/robert/Documents/GitHub/aws-sdk-cpp/cmake/" /home/robert/Documents/GitHub/aws-doc-sdk-examples/cpp/example_code/dynamodb

但是后来我收到了这组错误消息:

CMake Error at /home/robert/Documents/GitHub/aws-sdk-cpp/cmake/AWSSDKConfig.cmake:27 (include):
  include could not find load file:

    /home/robert/Documents/GitHub/aws-sdk-cpp/cmake/AWSSDKConfigVersion.cmake
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at /home/robert/Documents/GitHub/aws-sdk-cpp/cmake/AWSSDKConfig.cmake:29 (include):
  include could not find load file:

    /home/robert/Documents/GitHub/aws-sdk-cpp/cmake/platformDeps.cmake
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at /home/robert/Documents/GitHub/aws-sdk-cpp/cmake/AWSSDKConfig.cmake:86 (message):
  AWS SDK for C++ is missing, please install it first
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/robert/Documents/GitHub/aws-doc-sdk-examples-build/dynamodb/CMakeFiles/CMakeOutput.log".

我想我在这一点上一定是在做一些根本错误的事情。我怎样才能使这项工作?

标签: cmakeaws-sdkaws-sdk-cpp

解决方案


推荐阅读