You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ap...@apache.org on 2023/06/01 08:59:49 UTC
[arrow] branch main updated: GH-35850: [C++] Don't disable optimization with RelWithDebInfo (#35856)
This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new e44bcafc8d GH-35850: [C++] Don't disable optimization with RelWithDebInfo (#35856)
e44bcafc8d is described below
commit e44bcafc8db2441f5e18ebb27fd7e0fdba580148
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Thu Jun 1 17:59:42 2023 +0900
GH-35850: [C++] Don't disable optimization with RelWithDebInfo (#35856)
### Rationale for this change
We should not disable optimization with RelWithDebInfo. We just add debug information with RelWithDebInfo.
### What changes are included in this PR?
This change prioritizes optimization flags over debug flags.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
Yes.
* Closes: #35850
Authored-by: Sutou Kouhei <ko...@clear-code.com>
Signed-off-by: Antoine Pitrou <an...@python.org>
---
cpp/cmake_modules/SetupCxxFlags.cmake | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index 827e0fa4e6..34c177d213 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -642,8 +642,10 @@ if(NOT MSVC)
string(APPEND CMAKE_CXX_FLAGS_RELEASE "${CXX_RELEASE_FLAGS}")
string(APPEND CMAKE_C_FLAGS_DEBUG "${DEBUG_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG "${DEBUG_FLAGS}")
- string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO "${C_RELEASE_FLAGS} ${DEBUG_FLAGS}")
- string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CXX_RELEASE_FLAGS} ${DEBUG_FLAGS}")
+ # We must put release flags after debug flags to use optimization
+ # flags in release flags. RelWithDebInfo must enable optimization.
+ string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO "${DEBUG_FLAGS} ${C_RELEASE_FLAGS}")
+ string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${DEBUG_FLAGS} ${CXX_RELEASE_FLAGS}")
endif()
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")