Skip to content
Snippets Groups Projects
Commit f5992f91 authored by Jö Fahlke's avatar Jö Fahlke Committed by Steffen Müthing
Browse files

[buildsystem] Check for range-based for.

parent a6e02935
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant # HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
# HAVE_CONSTEXPR True if constexpr is supported # HAVE_CONSTEXPR True if constexpr is supported
# HAVE_KEYWORD_FINAL True if final is supported. # HAVE_KEYWORD_FINAL True if final is supported.
# HAVE_RANGE_BASED_FOR True if range-based for is supported and working.
include(CMakePushCheckState) include(CMakePushCheckState)
cmake_push_check_state() cmake_push_check_state()
...@@ -214,4 +215,15 @@ check_cxx_source_compiles(" ...@@ -214,4 +215,15 @@ check_cxx_source_compiles("
" HAVE_KEYWORD_FINAL " HAVE_KEYWORD_FINAL
) )
# range-based for
check_cxx_source_compiles("
int main(void)
{
int arr[3];
for(int &val : arr)
val = 0;
}
" HAVE_RANGE_BASED_FOR
)
cmake_pop_check_state() cmake_pop_check_state()
...@@ -11,6 +11,7 @@ install(PROGRAMS ...@@ -11,6 +11,7 @@ install(PROGRAMS
cxx0x_nullptr.m4 cxx0x_nullptr.m4
cxx11_constexpr.m4 cxx11_constexpr.m4
cxx11_final.m4 cxx11_final.m4
cxx11_range_based_for.m4
dune.m4 dune.m4
dune_all.m4 dune_all.m4
dune_autobuild.m4 dune_autobuild.m4
......
...@@ -14,6 +14,7 @@ ALLM4S = \ ...@@ -14,6 +14,7 @@ ALLM4S = \
cxx0x_nullptr.m4 \ cxx0x_nullptr.m4 \
cxx11_constexpr.m4 \ cxx11_constexpr.m4 \
cxx11_final.m4 \ cxx11_final.m4 \
cxx11_range_based_for.m4 \
dune.m4 \ dune.m4 \
dune_all.m4 \ dune_all.m4 \
dune_autobuild.m4 \ dune_autobuild.m4 \
......
# tests for C++11 range-based for support
# the associated define is called HAVE_RANGE_BASED_FOR
AC_DEFUN([DUNE_CXX11_RANGE_BASED_FOR],[
AC_CACHE_CHECK([for C++11 range-based for], [dune_cv_cxx11_range_based_for_support], [
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([CXX11])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(,[[
int arr[3];
for(int &val : arr)
val = 0;
]])],
[dune_cv_cxx11_range_based_for_support=yes],
[dune_cv_cxx11_range_based_for_support=no])
AC_LANG_POP
])
if test "x$dune_cv_cxx11_range_based_for_support" = xyes; then
AC_DEFINE([HAVE_RANGE_BASED_FOR], [1], [Define to 1 if C++11 range-based for is supported])
fi
])
...@@ -21,6 +21,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS], ...@@ -21,6 +21,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
AC_REQUIRE([CXX11]) AC_REQUIRE([CXX11])
AC_REQUIRE([NULLPTR_CHECK]) AC_REQUIRE([NULLPTR_CHECK])
AC_REQUIRE([CXX11_CONSTEXPR_CHECK]) AC_REQUIRE([CXX11_CONSTEXPR_CHECK])
AC_REQUIRE([DUNE_CXX11_RANGE_BASED_FOR])
AC_REQUIRE([DUNE_BOOST_BASE]) AC_REQUIRE([DUNE_BOOST_BASE])
AC_REQUIRE([DUNE_LINKCXX]) AC_REQUIRE([DUNE_LINKCXX])
AC_REQUIRE([DUNE_CHECKDEPRECATED]) AC_REQUIRE([DUNE_CHECKDEPRECATED])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment