Skip to content
Snippets Groups Projects
  • Sam Yates's avatar
    Test for xlC and refuse to build with it. (#519) · 775fe807
    Sam Yates authored and Benjamin Cumming's avatar Benjamin Cumming committed
    Fixes issue #517.
    
    Deprecate the IBM xlC compiler.
    xlC generates code that is an order of a magnitude slower than gcc, while generating spurious warnings, and requiring hacks and workarounds to pass all tests.
    Supporting it makes no sense.
    
    * Add test and fatal error for xlC detection in CheckCompilerXLC.cmake.
    * Move xlC 13 misdetection work around to CheckCompilerXLC.cmake.
    * Remove xlC-specific compatibility workarounds from code.
    775fe807
CheckCompilerXLC.cmake 644 B
# CMake (at least sometimes) misidentifies XL 13 for Linux as Clang.

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    try_compile(ignore ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/dummy.cpp COMPILE_DEFINITIONS --version OUTPUT_VARIABLE cc_out)
    string(REPLACE "\n" ";" cc_out "${cc_out}")
    foreach(line ${cc_out})
        if(line MATCHES "^IBM XL C")
            set(CMAKE_CXX_COMPILER_ID "XL")
        endif()
    endforeach(line)
endif()

# If we _do_ find xlC, don't try and build: too many bugs!

if(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
    message(FATAL_ERROR "Arbor does not support being built by the IBM xlC compiler")
endif()