Skip to content
Permalink
Browse files
GEODE-7235: Add backwards compatibility for Clang (#533)
* GEODE-7235: Support Clang version less than 11

- One of the new flags added for Clang 11 support was not available to earlier versions

Co-authored-by: Michael Oleske <moleske@pivotal.io>
Co-authored-by: Ivan Godwin <igodwin@pivotal.io>
  • Loading branch information
igodwin and moleske committed Oct 4, 2019
1 parent ef95f0c commit 80ffee7ad834bd23bfcd2a300e9ad7b08a3d0ca6
Showing 1 changed file with 11 additions and 5 deletions.
@@ -191,10 +191,6 @@ if (NOT HAVE_STDC_FORMAT_MACROS)
target_compile_definitions(c++11 INTERFACE __STDC_FORMAT_MACROS)
endif()

if ("Darwin" STREQUAL ${CMAKE_SYSTEM_NAME} )
set(DISABLED_MAC_WARNINGS -Wno-defaulted-function-deleted -Wno-c++2a-compat)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
# Force linker to error on undefined symbols in shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z defs")
@@ -230,6 +226,15 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
endif()

elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
check_cxx_compiler_flag(-Wno-defaulted-function-deleted CXXFLAGS_NO_DEFAULTED_FUNCTION_DELETED_ALLOWED)
if( CXXFLAGS_NO_DEFAULTED_FUNCTION_DELETED_ALLOWED )
set(DISABLED_NO_DEFAULTED_FUNCTION_DELETED_ALLOWED -Wno-defaulted-function-deleted)
endif()

check_cxx_compiler_flag(-Wno-c++2a-compat CXXFLAGS_NO_C++2a_COMPAT_ALLOWED)
if( CXXFLAGS_NO_C++2a_COMPAT_ALLOWED )
set(DISABLED_NO_C++2a_COMPAT_ALLOWED -Wno-c++2a-compat)
endif()
target_compile_options(_WarningsAsError INTERFACE
-Werror
-Wall
@@ -270,7 +275,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-documentation-unknown-command
${DISABLED_MAC_WARNINGS}
${DISABLED_NO_DEFAULTED_FUNCTION_DELETED_ALLOWED}
${DISABLED_NO_C++2a_COMPAT_ALLOWED}
)

if (USE_CPP_COVERAGE)

0 comments on commit 80ffee7

Please sign in to comment.