-
Notifications
You must be signed in to change notification settings - Fork 894
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
Improve handling of compilation flags with CMake #572
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Seems reasonable to me. @tmontgomery do you have a view? |
I'll review this shortly. |
denizevrenci
force-pushed
the
more_cmake
branch
2 times, most recently
from
November 1, 2018 10:02
327beed
to
48607cd
Compare
denizevrenci
force-pushed
the
more_cmake
branch
3 times, most recently
from
November 21, 2018 04:40
0c9ea16
to
677e511
Compare
denizevrenci
force-pushed
the
more_cmake
branch
2 times, most recently
from
December 2, 2018 17:27
8a48bcd
to
e27f882
Compare
denizevrenci
force-pushed
the
more_cmake
branch
2 times, most recently
from
December 6, 2018 06:17
d0f730b
to
f6aea5c
Compare
While CMAKE_SOURCE_DIR can point to another project root if Aeron is included as a subdirectory, PROJECT_SOURCE_DIR always points to Aeron's project root which will result in the same paths being generated regardless of a standalone build or subproject build.
This version is the minimum required for the variable CMAKE_CXX_STANDARD.
This adds the flag -std=c11 to GCC and Clang. Visual Studio does not seem to have full conformance to C11 standard yet.
This is equal to setting -std=c11 and -std=c++11 as opposed to -std=gnu11 and -std=gnu++11.
CMake automatically appends these when it detects CMAKE_C_STANDARD and CMAKE_CXX_STANDARD has been set.
This flag is automatically appended by CMake in debug builds which include RelWithDebInfo. Release mode should not have debug symbols.
This flag is added automatically by CMake in Debug mode.
add_compile_options works on both C and C++ sources and has a cleaner usage less prone to wiping off old flags.
add_definitions is semantically used to pass macro definitions to source files.
CMake automatically adds -O3 for release builds. Ofast adds potentially breaking non-standard optimizations during compilation. This change keeps -Ofast enabled for stand alone builds but disables it when Aeron is added with add_subdirectory command.
If a compiler set different from CC and CXX is used to build Aeron and tests and benchmarks are enabled by using CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, Aeron source and the tests are built using different compilers.
x86 or x86_64 compilation is already based on the architecture of the machine running the build. These flags are necessary if the target architecture is different from the one that compiles the code.
fexceptions is enabled for C++ by default.
denizevrenci
force-pushed
the
more_cmake
branch
from
December 12, 2018 05:07
f6aea5c
to
61f60eb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use CMake's idiomatic means of passing compilation flags to compilers.