bail out if some required C++-2011 features are not available

This commit is contained in:
Andreas Lauser
2013-06-13 23:40:00 +02:00
parent d23f71c349
commit 7298744a58
2 changed files with 26 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ set (${project}_DEPS
${${PROJECT}_DEPENDS_LIST}
)
# C++ project
cmake_minimum_required (VERSION 2.8)
project(${${project}_NAME})
@@ -92,6 +93,19 @@ include (UseWarnings)
include (OpmFind)
find_and_append_package_list_to (${project} ${${project}_DEPS})
# make sure the C++-2011 features which we rely on are supported
if (NOT HAVE_ARRAY)
message(FATAL_ERROR "std::array must be supported by the compiler for the ${project} module to work")
endif()
if (NOT HAVE_STATIC_ASSERT)
message(FATAL_ERROR "static assertations (via static_assert) must be supported for the ${project} module to work")
endif()
if (NOT HAVE_AUTO)
message(FATAL_ERROR "The 'auto' keyword must be supported by the compiler for the ${project} module to work")
endif()
# put debug information into every executable
include (UseDebugSymbols)

View File

@@ -12,7 +12,8 @@
# HAVE_CONSTEXPR True if constexpr attribute is available
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
# HAVE_STATIC_ASSERT True if static_assert is available
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt
# HAVE_AUTO True if the compiler supports the auto keyword
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supported
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
# HAVE_TUPLE True if std::tuple is available
@@ -189,6 +190,16 @@ CHECK_CXX_SOURCE_COMPILES("
" HAVE_STATIC_ASSERT
)
# auto keyword
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
auto foo = 1.23;
return 0;
}
" HAVE_AUTO
)
# variadic template support
CHECK_CXX_SOURCE_COMPILES("
#include <cassert>