You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/11/20 22:54:41 UTC

[arrow] branch master updated: ARROW-2720: [C++] Defer setting of -std=c++11 compiler option to CMAKE_CXX_STANDARD, use CMake option for -fPIC

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e6bf41  ARROW-2720: [C++] Defer setting of -std=c++11 compiler option to CMAKE_CXX_STANDARD, use CMake option for -fPIC
7e6bf41 is described below

commit 7e6bf4118af3cbc78dca1b47cf8da0f14f5fb802
Author: Wes McKinney <we...@apache.org>
AuthorDate: Tue Nov 20 17:54:33 2018 -0500

    ARROW-2720: [C++] Defer setting of -std=c++11 compiler option to CMAKE_CXX_STANDARD, use CMake option for -fPIC
    
    Small cleanup, since we were redundantly adding `-std=c++11` to the CXXFLAGS.
    
    Author: Wes McKinney <we...@apache.org>
    
    Closes #2995 from wesm/ARROW-2720 and squashes the following commits:
    
    b7f713f3a <Wes McKinney> Set CMAKE_CXX_STANDARD in SetupCxxFlags.cmake so it is also used in Python build
    e8bdefc48 <Wes McKinney> Defer setting of -std compiler option to CMAKE_CXX_STANDARD CMake option. Set CMAKE_POSITION_INDEPENDENT_CODE
---
 cpp/CMakeLists.txt                    |  6 ------
 cpp/cmake_modules/SetupCxxFlags.cmake | 15 ++++++++++-----
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a32ac0f..b2bf38e 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -57,12 +57,6 @@ include(CMakeParseArguments)
 include(ExternalProject)
 include(FindPkgConfig)
 
-# This ensures that things like gnu++11 get passed correctly
-set(CMAKE_CXX_STANDARD 11)
-
-# We require a C++11 compliant compiler
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
 include(GNUInstallDirs)
 
 # Compatibility with CMake 3.1
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake
index 465e61a..1727de5 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -23,8 +23,17 @@ CHECK_CXX_COMPILER_FLAG("-msse3" CXX_SUPPORTS_SSE3)
 # power compiler flags
 CHECK_CXX_COMPILER_FLAG("-maltivec" CXX_SUPPORTS_ALTIVEC)
 
-# compiler flags that are common across debug/release builds
+# This ensures that things like gnu++11 get passed correctly
+set(CMAKE_CXX_STANDARD 11)
+
+# We require a C++11 compliant compiler
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+# Build with -fPIC so that can static link our libraries into other people's
+# shared libraries
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
+# compiler flags that are common across debug/release builds
 if (WIN32)
   # TODO(wesm): Change usages of C runtime functions that MSVC says are
   # insecure, like std::getenv
@@ -81,10 +90,6 @@ endif(NOT BUILD_WARNING_LEVEL)
 
 string(TOUPPER ${BUILD_WARNING_LEVEL} UPPERCASE_BUILD_WARNING_LEVEL)
 
-if (NOT ("${COMPILER_FAMILY}" STREQUAL "msvc"))
-  set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -std=c++11")
-endif()
-
 if ("${UPPERCASE_BUILD_WARNING_LEVEL}" STREQUAL "CHECKIN")
   # Pre-checkin builds
   if ("${COMPILER_FAMILY}" STREQUAL "msvc")