以前在cmake中要判断一个编译器是否支持C++11挺麻烦的,要根据编译器的类型和版本来判断。 从cmake 3.1版本开始增加了一个CMAKE_CXX_COMPILE_FEATURES变量用于获取当前C++ 编译器支持的编译特性列表,列表中是一些定义在CMAKE_CXX_KNOWN_FEATURES(C++已知特性)中的特性名字,比如cxx_lambdas即为当前编译器支持lambda表达式。
CMake语言是平台无关的中间编译工具。同一个CMake编译规则在不同系统平台构建出不同的可执行构建文件。...
if (NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) endif() For project consuming the latest release of fmt via add_subdirectory like seen here who also use the modern target_compile_features-based approach to enable a specific language standard like C++17 have their builds broken by ...
Now that we're targeting platforms with cmake-3.16+ available, we should use target_compile_features with cxx_std_## instead of set(CMAKE_CXX_STANDARD ##). Using target_compile_features helps downstream packages to identify the minimum s...
CMake没有将编译器选项-std设置为gnu17或c++17,尽管我将target_compile_features设置为cxx_std_17D:\...