diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 67fb9ec721ac..e0ab141a1f96 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -98,7 +98,9 @@ set(KNOWN_WARNINGS -Wno-error=unused-function \ -Wno-error=unused-variable \ -Wno-strict-aliasing \ - -Wno-ignored-qualifiers") + -Wno-ignored-qualifiers \ + -Wno-deprecated-declarations \ + -Wno-attributes") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(KNOWN_WARNINGS "-Wno-error=unused-but-set-variable \ @@ -141,8 +143,25 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_compile_definitions(_GNU_SOURCE) endif() +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KNOWN_WARNINGS}") +# Keep same compile option with Velox. +execute_process( + COMMAND + bash -c + "( source ${VELOX_HOME}/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))" + OUTPUT_VARIABLE SCRIPT_CXX_FLAGS + RESULT_VARIABLE COMMAND_STATUS) +if(COMMAND_STATUS EQUAL "1") + message(FATAL_ERROR "Unable to determine compiler flags!") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") + # # Dependencies # diff --git a/cpp/core/CMakeLists.txt b/cpp/core/CMakeLists.txt index 88b0fd883e5c..5a5eeac35480 100644 --- a/cpp/core/CMakeLists.txt +++ b/cpp/core/CMakeLists.txt @@ -22,28 +22,6 @@ include(FindPkgConfig) include(GNUInstallDirs) include(CheckCXXCompilerFlag) -set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes") -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") -endif() - -if(NOT DEFINED VELOX_HOME) - set(VELOX_HOME ${GLUTEN_HOME}/ep/build-velox/build/velox_ep) - message(STATUS "Set VELOX_HOME to ${VELOX_HOME}") -endif() - -# Keep same compile option with Velox. -execute_process( - COMMAND - bash -c - "( source ${VELOX_HOME}/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))" - OUTPUT_VARIABLE SCRIPT_CXX_FLAGS - RESULT_VARIABLE COMMAND_STATUS) -if(COMMAND_STATUS EQUAL "1") - message(FATAL_ERROR "Unable to determine compiler flags!") -endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") message("Core module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}") set(BOOST_MIN_VERSION "1.42.0") diff --git a/cpp/velox/CMakeLists.txt b/cpp/velox/CMakeLists.txt index 9e110853eb6e..4503d5947d78 100644 --- a/cpp/velox/CMakeLists.txt +++ b/cpp/velox/CMakeLists.txt @@ -23,12 +23,6 @@ include(GNUInstallDirs) include(CheckCXXCompilerFlag) include(FindPackageHandleStandardArgs) -set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes") -if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") -endif() - set(SYSTEM_LIB_PATH "/usr/lib" CACHE PATH "System Lib dir") @@ -62,18 +56,6 @@ if(NOT DEFINED VELOX_HOME) message(STATUS "Set VELOX_HOME to ${VELOX_HOME}") endif() -# Keep same compile option with Velox. -execute_process( - COMMAND - bash -c - "( source ${VELOX_HOME}/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))" - OUTPUT_VARIABLE SCRIPT_CXX_FLAGS - RESULT_VARIABLE COMMAND_STATUS) -if(COMMAND_STATUS EQUAL "1") - message(FATAL_ERROR "Unable to determine compiler flags!") -endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}") - message("Velox module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}") # User can specify VELOX_BUILD_PATH, if Velox are built elsewhere.