Skip to content

Add ability to detect compiler language standards as features #1715

@xq114

Description

@xq114

你在什么场景下需要该功能?

#1712

cmake的target_compile_features支持high level的standard探测和low level的具体feature探测,xmake只支持后者

https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html

另外cmake还支持cuda的standard探测,这个也可以加上,命名可以为cuda_cxx_std_14cuda_cxx_std_17这样

描述可能的解决方案

discussion里面说用flag探测,但这个并不行,例如msvc没有-std:c++11这个flag(最低就是c++14,默认c++17),但探测是否支持c++11应该返回“是”。可以根据编译器版本判断,也可以借助__cplusplus宏来判断。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions