CMake 3.1.0 ( 2) CMake target_compile_features, , ++. CMake , ++ (, -std = ++ 11).
, ++ main.cc ++:
cxx_strong_enums, cxx_constexpr, cxx_auto_type
#include <cstdlib>
int main(int argc, char *argv[]) {
enum class Color { Red, Orange, Yellow, Green, Blue, Violet };
constexpr float a = 3.1415f;
auto b = a;
return EXIT_SUCCESS;
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(foobar CXX)
add_executable(foobar main.cc)
set(needed_features
cxx_strong_enums
cxx_constexpr
cxx_auto_type)
target_compile_features(foobar PRIVATE ${needed_features})
To date (November 21, 2014) CMake version 3.1.0 has not yet been released. It is now available as a candidate for release 2. Note: this functionality has not yet been released in the stable release of CMake, so I think you should only use this if you like to experiment.
source
share