From 43e9b29e50b4904bf3210004e6d0e123ae70e13e Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 2 Feb 2020 08:29:33 -0800 Subject: [PATCH] Only use compiler features if available --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a645ef32..a62ee7e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} include(cxx14) include(CheckCXXCompilerFlag) -set(FMT_REQUIRED_FEATURES cxx_auto_type cxx_variadic_templates) +list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_variadic_templates" index) +if (${index} GREATER -1) + # Use cxx_variadic_templates instead of more appropriate cxx_std_11 for + # compatibility with older CMake versions. + set(FMT_REQUIRED_FEATURES cxx_variadic_templates) +endif () +message(STATUS "Required features: ${FMT_REQUIRED_FEATURES}") if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(PEDANTIC_COMPILE_FLAGS -pedantic-errors -Wall -Wextra -pedantic