GNU-CXX-FeatureTests.cmake 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Reference: http://gcc.gnu.org/projects/cxx0x.html
  2. set(_oldestSupported "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408")
  3. # Introduced in GCC 4.8.1
  4. set(_cmake_feature_test_cxx_reference_qualified_functions
  5. "((__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1) && __cplusplus >= 201103L")
  6. set(GNU48_CXX11 "(__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L")
  7. set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}")
  8. # TODO: Should be supported by GNU 4.7
  9. set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
  10. set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}")
  11. set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
  12. set(_cmake_feature_test_cxx_final "${GNU47_CXX11}")
  13. set(_cmake_feature_test_cxx_noexcept "${GNU47_CXX11}")
  14. set(_cmake_feature_test_cxx_nonstatic_member_init "${GNU47_CXX11}")
  15. set(_cmake_feature_test_cxx_override "${GNU47_CXX11}")
  16. set(_cmake_feature_test_cxx_user_literals "${GNU47_CXX11}")
  17. # NOTE: C++11 was ratified in September 2011. GNU 4.7 is the first minor
  18. # release following that (March 2012), and the first minor release to
  19. # support -std=c++11. Prior to that, support for C++11 features is technically
  20. # experiemental and possibly incomplete (see for example the note below about
  21. # cxx_variadic_template_template_parameters)
  22. # TODO: Should be supported by GNU 4.6
  23. set(GNU46_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
  24. set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
  25. set(_cmake_feature_test_cxx_nullptr "${GNU46_CXX11}")
  26. set(_cmake_feature_test_cxx_range_for "${GNU46_CXX11}")
  27. # TODO: Should be supported by GNU 4.5
  28. set(GNU45_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
  29. set(_cmake_feature_test_cxx_explicit_conversions "${GNU45_CXX11}")
  30. set(_cmake_feature_test_cxx_lambdas "${GNU45_CXX11}")
  31. set(_cmake_feature_test_cxx_raw_string_literals "${GNU45_CXX11}")
  32. # TODO: Should be supported by GNU 4.4
  33. set(GNU44_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
  34. set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
  35. set(_cmake_feature_test_cxx_defaulted_functions "${GNU44_CXX11}")
  36. set(_cmake_feature_test_cxx_deleted_functions "${GNU44_CXX11}")
  37. set(_cmake_feature_test_cxx_strong_enums "${GNU44_CXX11}")
  38. set(_cmake_feature_test_cxx_trailing_return_types "${GNU44_CXX11}")
  39. set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}")
  40. # TODO: If features are ever recorded for GNU 4.3, there should possibly
  41. # be a new feature added like cxx_variadic_template_template_parameters,
  42. # which is implemented by GNU 4.4, but not 4.3. cxx_variadic_templates is
  43. # actually implemented by GNU 4.3, but variadic template template parameters
  44. # 'completes' it, so that is the version we record as having the variadic
  45. # templates capability in CMake. See
  46. # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf
  47. # TODO: Should be supported by GNU 4.3
  48. set(GNU43_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
  49. set(_cmake_feature_test_cxx_decltype "${GNU43_CXX11}")
  50. set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}")
  51. set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}")
  52. set(_oldestSupported)