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 鈥揇aws-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.
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.
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).
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.
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
@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.
Thanks @Skarlso much appreciated! Did you use the cmake 鈥揇aws-sdk-cpp_DIR="/Users/-...-/aws/aws-sdk-cpp-1.0.51/build/" .. convention when calling cmake?
No, I think that didn't work in the end. Look at this script how it builds the SDK:
https://github.com/Skarlso/furnace/blob/master/scripts/prepare-aws-sdk.sh
For what it's worth, I got the 鈥揇aws-sdk-cpp_DIR= to work correctly if the directory passed is the fullpath, so /Users/... on macOS.
For what it's worth, I got the
鈥揇aws-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.
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.
I've reopened https://github.com/aws/aws-sdk-cpp/issues/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.
Most helpful comment
No, I think that didn't work in the end. Look at this script how it builds the SDK:
https://github.com/Skarlso/furnace/blob/master/scripts/prepare-aws-sdk.sh