Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set set correct defaults (c++ 11) as a public property #1338

Open
dblock opened this issue Mar 5, 2020 · 1 comment
Open

Set set correct defaults (c++ 11) as a public property #1338

dblock opened this issue Mar 5, 2020 · 1 comment

Comments

@dblock
Copy link

@dblock dblock commented Mar 5, 2020

What platform/OS are you using?

MacOS

Which version of the SDK?

Mojave

What compiler are you using? what version?

CMake 3.16.4

Coming from awsdocs/aws-doc-sdk-examples#1022 (comment)

Currently projects require setting the target compile features to C++ 11 in CMakeLists.txt with target_compile_features(my-example PUBLIC cxx_std_11) or risk getting the following errors:

[ 50%] Building CXX object CMakeFiles/list-s3-buckets.dir/main.cpp.o
In file included from /Users/dblock/source/aws-sdk/list-s3-buckets/main.cpp:2:
In file included from /usr/local/include/aws/core/Aws.h:17:
In file included from /usr/local/include/aws/core/utils/logging/LogLevel.h:20:
In file included from /usr/local/include/aws/core/utils/memory/stl/AWSString.h:20:
In file included from /usr/local/include/aws/core/utils/memory/stl/AWSAllocator.h:21:
/usr/local/include/aws/core/utils/memory/AWSMemory.h:162:78: error: 'T' does not refer to a value
            std::size_t headerSize = (std::max)(sizeof(std::size_t), alignof(T));
                                                                             ^
/usr/local/include/aws/core/utils/memory/AWSMemory.h:149:23: note: declared here
    template<typename T>
                      ^

There should be a way to not have to do this for every project.

@Lectem

This comment has been minimized.

Copy link

@Lectem Lectem commented Mar 5, 2020

Note that it would require to have at least one exported target to have this compile feature requirement.

It should either be used (transitively) for all targets that get installed or it could be handled by the https://github.com/aws/aws-sdk-cpp/blob/master/cmake/AWSSDKConfig.cmake file.
Since it already iterates over targets it could probably call target_compile_features for each of them ?

It already tries to do something with a hardcoded CPP_STANDARD

set(CPP_STANDARD "11" CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.")
that knows how to set the standard only for gcc/linux (see
list(APPEND AWS_COMPILER_FLAGS "-fno-exceptions" "-std=c++${CPP_STANDARD}")
and
list(APPEND CMAKE_REQUIRED_FLAGS "-std=c++${CPP_STANDARD}")
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.