refactor: Cleanup compiler options #4
Merged
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.
For now we want to always compile without optimizations because
we found that using
-O2causes issues selecting data from tables.Uur mariadb.spec adds
-O2to CMAKE_CXX_FLAGS_RELWITHDEBINFOwhen the build type is RELWITHDEBINFO (which is the default).
This then causes this storage engine to build with -O2
optimizations becuase CMAKE_CXX_FLAGS_RELWITHDEBINFO are
added to the end of CMAKE_CXX_FLAGS.
We can work around this issue by appending -O0 to
CMAKE_CXX_FLAGS_RELWITHDEBINFO which will then cause -O0
to override the -O2 set previously but this pollutes the
global CMAKE_CXX_FLAGS_RELWITHDEBINFO variable and causes everything
to be built unoptimized. Instead we can use target_compile_options
which only pass compile options for this target.
The second commit:
Removes setting CMAKE_C_FLAGS because this project only contains c++ source files
and we do not want to pollute the global CMAKE_C_FLAGS variable.