Skip to content

Issues Building Project With Cmake and aws-sdk-cpp_DIR #406

Closed

Description

@Skarlso

Hi.

So, I was following steps here:

https://aws.amazon.com/blogs/developer/using-cmake-exports-with-the-aws-sdk-for-c/

My project is a little bit more complex, with multiple project files, but it essentially boils down to these parts:

...
find_package(aws-sdk-cpp)

# Use the created library to link to the source.
add_executable(furnace $<TARGET_OBJECTS:furnace_object> furnace.cpp)

# I tried the blog post aws-cpp-sdk-core ( but maybe that's a typo? )
target_link_libraries(furnace aws-sdk-cpp-core)
...

And then calling this:

cd build
cmake –Daws-sdk-cpp_DIR="/Users/-...-/aws/aws-sdk-cpp-1.0.51/build/" ..

Also, I've built the project on osx. I used it previously, if I hardcoded all the path everywhere, which is less than ideal. So I know the library works fine.

What I'm getting when I'm running this is:

CMake Warning at furnace/CMakeLists.txt:8 (find_package):
  By not providing "Findaws-sdk-cpp.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "aws-sdk-cpp", but CMake did not find one.

  Could not find a package configuration file provided by "aws-sdk-cpp" with
  any of the following names:

    aws-sdk-cppConfig.cmake
    aws-sdk-cpp-config.cmake

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

The files it's looking for IS THERE.

The whole project can be located here => https://github.com/Skarlso/furnace

Any advice / help is very welcomed!

I'm building by hand. The operating system is OSX. And it's not an IOS project.

Thank you in advance.
Gergely.

Activity

  1. Skarlso commented on Jan 10, 2017

    @Skarlso
    Author

    So I solved this.

    Apparently, the blog post is NOT a typo. Which is totally insane actually.

    Also, apparently, cmake -Daws-sdk-cpp_DIR DID NOT WORK.

    However, getting it as an environment variable and setting it in CMAKE worked.

    # Find the installed AWS core package
    # Don't need all of them
    set(aws-sdk-cpp_DIR $ENV{AWS_SDK_CPP_DIR})
    find_package(aws-sdk-cpp)
    
    # Use the created library to link to the source.
    add_executable(furnace $<TARGET_OBJECTS:furnace_object> furnace.cpp)
    
    target_link_libraries(furnace aws-cpp-sdk-core)
    

    Notice that the exported target is aws-cpp-sdk-core instead of aws-sdk-cpp-core as you would expect.

    Is this intentional?

    Cheers,
    Gergely.

  2. bretambrose commented on Jan 10, 2017

    @bretambrose
    Contributor

    Using a standard cmake command line option like CMAKE_PREFIX_PATH also works. I prefer that since it's easier to remember and more generic, especially across projects.

    As far cpp-sdk vs. sdk-cpp goes, that was an accidental decision made very, very early in the project that now taunts us from an unchangeable position (due to backwards compatibility).

  3. Skarlso commented on Jan 10, 2017

    @Skarlso
    Author

    Yes, but what if I want to set CMAKE_PREFIX_PATH to something else? :) I would rather use something specific. :)

    Thanks for the heads up!

    This can be closed.

  4. RobertHerreraEECS commented on Oct 26, 2017

    @RobertHerreraEECS

    Can someone provide context on what their CMake Text file looks like. I've tried following the thread and the posted solution... but still no luck. Thx

  5. Skarlso commented on Oct 26, 2017

    @Skarlso
    Author

    @RobertHerreraEECS Hey Robert. You can take a peak at my project here: https://github.com/Skarlso/furnace/blob/master/CMakeLists.txt.

    I haven't updated it though in a while because frankly, the CPP AWS sdk is terrible in this way that I have to download some gigs of stuff to get parts working. I setup a docker container which had prebuilt libraries so travis could test with the container. That's here: https://hub.docker.com/r/skarlso/gcc/ Have fun.

  6. RobertHerreraEECS commented on Oct 26, 2017

    @RobertHerreraEECS

    Thanks @Skarlso much appreciated! Did you use the cmake –Daws-sdk-cpp_DIR="/Users/-...-/aws/aws-sdk-cpp-1.0.51/build/" .. convention when calling cmake?

  7. Skarlso commented on Oct 26, 2017

    @Skarlso
    Author
  8. jhodges commented on Dec 21, 2017

    @jhodges

    For what it's worth, I got the –Daws-sdk-cpp_DIR= to work correctly if the directory passed is the fullpath, so /Users/... on macOS.

  9. dblock commented on Mar 3, 2020

    @dblock
    Contributor

    For what it's worth, I got the –Daws-sdk-cpp_DIR= to work correctly if the directory passed is the fullpath, so /Users/... on macOS.

    I can't get it to work with the instructions in that blog post (cmake -Daws-sdk-cpp_DIR=full path). Is the blog post incorrect? I will get it fixed.

  10. KaibaLopez commented on Mar 3, 2020

    @KaibaLopez
    Contributor

    Hi @dblock,
    I think the blog post is a bit outdated... could you try and change the cmake to something like:

    cmake_minimum_required(VERSION 3.5)
    project(s3Sample)
    find_package(AWSSDK REQUIRED COMPONENTS s3)
    set(CMAKE_CXX_STANDARD 11)
    add_executable(Sample "main.cpp")
    # list all deps for static linking
    target_link_libraries(Sample ${AWSSDK_LINK_LIBRARIES})
    target_compile_options(Sample PRIVATE "-Wall" "-Werror")
    

    this assumes that your ran make install on the sdk before hand though.

  11. dblock commented on Mar 3, 2020

    @dblock
    Contributor

    I've reopened #1334 which has a different error related to dependencies, rather than adding more to this issue here. I shouldn't need to globally make install the SDK either, but that doesn't help anyway. I'll update everything when I can make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions