Skip to content

Document and add a cmake guard for minimum compiler versions #2732

Description

@paul0403

We use c++20 across the board.
However, the clang compiler only has partial support for c++20 in some older versions.

We should clearly document the minimum clang and gcc version required to build catalyst from source.

We should also add a guard for it in cmake, to terminate the build at config time if minimum compiler versions are not met on the system.
For how to do it in cmake, see https://stackoverflow.com/questions/14933172/how-can-i-add-a-minimum-compiler-version-requisite

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    # require at least gcc 4.8
    if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
        message(FATAL_ERROR "GCC version must be at least 4.8!")
    endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    # require at least clang 3.2
    if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
        message(FATAL_ERROR "Clang version must be at least 3.2!")
    endif()
else()
    message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif()

Metadata

Metadata

Assignees

No one assigned

    Labels

    CI/BuildPull requests that update CI or build scriptshousecleaning

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions