You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/01/08 05:17:00 UTC
[2/2] kudu git commit: Support CXXFLAGS
Support CXXFLAGS
I ran into a case when building Kudu in native-toolchain
where I want to build Kudu with flags matching those used
by other libraries. Specifically, "-D_GLIBCXX_USE_CXX11_ABI=0"
is needed to allow linking with other libraries built with
that flag. I'm doing this to make it easier to stage a GCC
upgrade in Impala.
By default CMake puts CXXFLAGS into CMAKE_CXX_FLAGS but
this is then clobbered by Kudu's CMake script.
See https://cmake.org/cmake/help/latest/envvar/CXXFLAGS.html
The fix is to append to CMAKE_CXX_FLAGS instead of overwriting it.
Change-Id: Id9dcad5ccb4fc4c081d96eaa40957175731c7a9e
Reviewed-on: http://gerrit.cloudera.org:8080/12162
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/f6761b94
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/f6761b94
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/f6761b94
Branch: refs/heads/master
Commit: f6761b947637b143543dc8d42d1056f0128815f9
Parents: 22b1bc3
Author: Tim Armstrong <ta...@cloudera.com>
Authored: Thu Jan 3 23:56:57 2019 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Tue Jan 8 05:16:39 2019 +0000
----------------------------------------------------------------------
CMakeLists.txt | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/f6761b94/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3856f4..7a1c16c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,18 +204,19 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELWITHDEBINFO" OR "${CMAKE_BUILD_TYPE}" STR
set(CMAKE_BUILD_TYPE RELEASE)
endif ()
-# Set compile flags based on the build type.
+# Append to compile flags based on the build type. It's important not to clobber
+# CMAKE_CXX_FLAGS because it may contain flags specified by the user.
message("Configured for ${CMAKE_BUILD_TYPE} build (set with cmake -DCMAKE_BUILD_TYPE={release,debug,...})")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_DEBUG})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_DEBUG}")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "FASTDEBUG")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_FASTDEBUG})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_FASTDEBUG}")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_RELEASE})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_RELEASE}")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_GEN")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_PROFILE_GEN})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_PROFILE_GEN}")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_BUILD")
- set(CMAKE_CXX_FLAGS ${CXX_FLAGS_PROFILE_BUILD})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_PROFILE_BUILD}")
else()
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
endif ()