Skip to content

Commit

Permalink
GH-45325: [C++] Improved error message when using clang++ without clang
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Jan 22, 2025
1 parent 984519d commit fd0e85a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ include(CheckCXXSourceCompiles)

message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}")

if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL CMAKE_C_COMPILER_ID)
message(FATAL_ERROR "When using clang++ you must also use clang")
endif()
endif()

if(NOT DEFINED ARROW_CPU_FLAG)
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(ARROW_CPU_FLAG "emscripten")
Expand Down Expand Up @@ -430,14 +436,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STRE
"Clang")
# Clang options for all builds

# Using Clang with ccache causes a bunch of spurious warnings that are
# purportedly fixed in the next version of ccache. See the following for details:
#
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
# http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")

# Avoid error when an unknown warning flag is passed
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-unknown-warning-option")
# Add colors when paired with ninja
Expand Down

0 comments on commit fd0e85a

Please sign in to comment.