From 1849735f127c86deed80d90521b7117d1ebb38da Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 11 Feb 2018 07:25:53 -0800 Subject: [PATCH] Fallback to c++11 if c++14 not available --- support/cmake/cxx14.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/support/cmake/cxx14.cmake b/support/cmake/cxx14.cmake index c86cf508..d725917a 100644 --- a/support/cmake/cxx14.cmake +++ b/support/cmake/cxx14.cmake @@ -40,6 +40,17 @@ if (FMT_USE_CPP14) check_cxx_compiler_flag(-std=c++1y HAVE_STD_CPP1Y_FLAG) if (HAVE_STD_CPP1Y_FLAG) set(CPP14_FLAG -std=c++1y) + else () + # Fallback on c++11 if c++14 is not available. + check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG) + if (HAVE_STD_CPP11_FLAG) + set(CPP14_FLAG -std=c++11) + else () + check_cxx_compiler_flag(-std=c++0x HAVE_STD_CPP11_FLAG) + if (HAVE_STD_CPP0X_FLAG) + set(CPP14_FLAG -std=c++0x) + endif () + endif () endif () endif () endif ()