diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 043863fac..7e1085369 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -22,6 +22,11 @@ The features known to this version of CMake are: .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf +``cxx_alignof`` + Alignment control ``alignof``, as defined in N2341_. + + .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf + ``cxx_auto_type`` Automatic type deduction, as defined in N1984_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 86d55578d..26b7ff630 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -7,6 +7,7 @@ set(_cmake_feature_test_cxx_reference_qualified_functions "((__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1) && __cplusplus >= 201103L") set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}") +set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}") set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}") # TODO: Should be supported by GNU 4.7 set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b1dd72183..2b76d454d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -44,6 +44,7 @@ #define FOR_EACH_CXX_FEATURE(F) \ F(cxx_alias_templates) \ F(cxx_alignas) \ + F(cxx_alignof) \ F(cxx_auto_type) \ F(cxx_constexpr) \ F(cxx_decltype) \ diff --git a/Tests/CompileFeatures/cxx_alignof.cpp b/Tests/CompileFeatures/cxx_alignof.cpp new file mode 100644 index 000000000..63b14fec9 --- /dev/null +++ b/Tests/CompileFeatures/cxx_alignof.cpp @@ -0,0 +1,5 @@ + +int someFunc() +{ + return alignof(int); +}