-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARROW-18231: [C++][CMake] Add support for overriding optimization lev…
…el (#15022) We can overriding optimization level by `-DCMAKE_CXX_FLAGS_${CONFIG}=-OX` such as `-DCMAKE_CXX_FLAGS_RELEASE=-O0` with this change. Note that we can't use CXXFLAGS environment variable because CMake uses `${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CONFIG}}` order and optimization flags are specified in `CMAKE_CXX_FLAGS_${CONFIG}` not `CMAKE_CXX_FLAGS`. (CMAKE_CXX_FLAGS CMake variable is initialized by CXXFLAGS environment variable.) See also: https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html > The flags in this variable will be passed to the compiler before > those in the per-configuration `CMAKE_<LANG>_FLAGS_<CONFIG>` variant, > and before flags added by the `add_compile_options()` or > `target_compile_options()` commands. This change also cleans up the followings: * C/CXX flags related codes * Use `CMAKE_C_FLAGS_${BUILD_TYPE}`/`CMAKE_CXX_FLAGS_${BUILD_TYPE}` instead of putting all flags to `CMAKE_C_FLAGS`/`CMAKE_CXX_FLAGS` * `externalproject_add()` related codes * Extract common options as `EP_XXX` * Use `string(APPEND)`/`list(APPEND)` as much as possible instead of `set(XXX "${XXX} ...")`/`set(XXX ${XXX} ...)` Authored-by: Sutou Kouhei <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
- Loading branch information
Showing
7 changed files
with
236 additions
and
279 deletions.
There are no files selected for viewing
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
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
Oops, something went wrong.