+
Skip to content

CMake: Require a GNU compiler #457

Open
@BlakeFreer

Description

@BlakeFreer

Timeline: Summer 2025

People on MacOS often get compiler errors since CMake defaults to clang++ instead of g++, and clang doesn't support all of the features we use.

We should throw an error if the compiler is not GNU g++.

I got this snippet from reddit, haven't tested

if ((NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND
    (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
    message( FATAL_ERROR "Unsupported compiler! (Only GCC and Clang are supported.)" )
endif()

https://www.reddit.com/r/cpp_questions/comments/nmr95e/cmake_require_either_gcc_or_clang/
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html

Of course we need to modify it to only accept GNU.

This should go in the cli and linux mcal CMakeLists since it is a platform-dependent fix

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载