Fallback to c++11 if c++14 not available

This commit is contained in:
Victor Zverovich 2018-02-11 07:25:53 -08:00
parent 3239c51814
commit 1849735f12

View File

@ -40,6 +40,17 @@ if (FMT_USE_CPP14)
check_cxx_compiler_flag(-std=c++1y HAVE_STD_CPP1Y_FLAG) check_cxx_compiler_flag(-std=c++1y HAVE_STD_CPP1Y_FLAG)
if (HAVE_STD_CPP1Y_FLAG) if (HAVE_STD_CPP1Y_FLAG)
set(CPP14_FLAG -std=c++1y) 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 () endif ()
endif () endif ()