Repository: arrow Updated Branches: refs/heads/master 89dc55789 -> 8afe92c6c
ARROW-578: [C++] Add -DARROW_CXXFLAGS=... option to make CMake more consistent I've had issues on CMake 2.8.x with `-DCMAKE_CXX_FLAGS=$MY_CXXFLAGS` not passing on the flags to the compiler. But it seems to work properly in our Travis CI setup, so go figure. Some Google searches seem to confirm this is a known issue, and having a specific "user flags" option is a way around it. We just did the same thing in parquet-cpp. Author: Wes McKinney <[email protected]> Closes #348 from wesm/ARROW-578 and squashes the following commits: 1103bed [Wes McKinney] Use ARROW_CXXFLAGS in Travis CI 086d643 [Wes McKinney] Add -DARROW_CXXFLAGS=... option to make CMake behavior more consistent across versions Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/8afe92c6 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/8afe92c6 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/8afe92c6 Branch: refs/heads/master Commit: 8afe92c6cb966d7a3fa5fe30a24bb10be49afc06 Parents: 89dc557 Author: Wes McKinney <[email protected]> Authored: Sat Feb 25 15:51:03 2017 -0500 Committer: Wes McKinney <[email protected]> Committed: Sat Feb 25 15:51:03 2017 -0500 ---------------------------------------------------------------------- ci/travis_before_script_cpp.sh | 4 ++-- cpp/CMakeLists.txt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/8afe92c6/ci/travis_before_script_cpp.sh ---------------------------------------------------------------------- diff --git a/ci/travis_before_script_cpp.sh b/ci/travis_before_script_cpp.sh index 94a889c..feacf8f 100755 --- a/ci/travis_before_script_cpp.sh +++ b/ci/travis_before_script_cpp.sh @@ -36,11 +36,11 @@ CMAKE_COMMON_FLAGS="\ if [ $TRAVIS_OS_NAME == "linux" ]; then cmake -DARROW_TEST_MEMCHECK=on \ $CMAKE_COMMON_FLAGS \ - -DCMAKE_CXX_FLAGS="-Werror" \ + -DARROW_CXXFLAGS=-Werror \ $CPP_DIR else cmake $CMAKE_COMMON_FLAGS \ - -DCMAKE_CXX_FLAGS="-Werror" \ + -DARROW_CXXFLAGS=-Werror \ $CPP_DIR fi http://git-wip-us.apache.org/repos/asf/arrow/blob/8afe92c6/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 06a1892..be3d4b9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -57,6 +57,9 @@ endif(CCACHE_FOUND) # Top level cmake dir if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + set(ARROW_CXXFLAGS "" CACHE STRING + "Compiler flags to append when compiling Arrow") + option(ARROW_BUILD_STATIC "Build the libarrow static libraries" ON) @@ -120,7 +123,7 @@ endif() include(SetupCxxFlags) # Add common flags -set(CMAKE_CXX_FLAGS "${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "${ARROW_CXXFLAGS} ${CXX_COMMON_FLAGS} ${CMAKE_CXX_FLAGS}") # Determine compiler version include(CompilerInfo)
