-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Carry C_FLAGS / CXX_FLAGS into the aws-c-* libs #1087
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
Conversation
I think this is the place that switches between /MT and /MD |
@@ -27,6 +27,9 @@ if(POLICY CMP0056) | |||
cmake_policy(SET CMP0056 NEW) | |||
endif() | |||
|
|||
# build the sdk targets | |||
project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
project() defines the INSTALL_PREFIX which we test for later.
The call is intentionally placed after the cmake commands to build the third-party libs.
We should have documented that better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping!
any chance of updating this PR?
This code isn't in the commit that is being checked out with the ExternalProject. So that's probably not butchering it. But for what it's worth, BUILD_SHARED_LIBS is OFF in this case - at least at the top level. |
Aha, now I see that this is not a cmake issue, but rather that the SDK is not using |
Greetings! Sorry to say but this is a very old issue that is probably not getting as much attention as it deservers. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one. |
Issue #, if available:
#1086
Description of changes:
Moving the project declaration up was for good form and it enables tools like conan to know what language they are running in so they can inject library search paths and compilation flags before running the execute_process subprocess builds for the aws-c-* libs.
The rest was to ensure that at least C_FLAGS and CXX_FLAGS are carried into the separate child cmake processes that are executed first with execute_process and then later via ExternalProject. Without this, building an x86 build on an x86-64 machine would succeed but would produce an unusable set of libs where the aws-c-* libs were all 64 bit and the main aws-sdk-cpp libs were all 32 bit as requested.
This doesn't fix an outstanding issue though. When using
/MT
on Windows the same kind of problem as above occurs. The aws-c-* libs all link against the shared multi-threaded runtime - /MD. But the aws-sdk-cpp libs do as requested and use the static runtime. And again, these build correctly but they are unusable because of the conflicting runtimes.It's not enough to carry the CMAKE_C_FLAGS that contain /MT. There seems to be some mechanism (maybe in the way the child cmake runs or in the aws-c-* libs themselves) that clobbers the /MT and converts it to /MD. So it is not possible to build a usable aws-sdk-cpp statically on Windows using the static runtime. And this PR won't fix that. But it will at least enable building x86 libraries on an x86-64 machine for Linux and Windows.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.