From a54cb108d4634e768ad3ce0855313991ccc768de Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 22 May 2023 22:17:32 +0100 Subject: [PATCH] CMake: Do not fail on unknown compiler features (#3453) If CMake does not know much about a compiler, `target_compile_features` will fail. Issue a warning instead. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb650f41..e1f57bb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,7 +297,11 @@ if (FMT_PEDANTIC) target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS}) endif () -target_compile_features(fmt PUBLIC cxx_std_11) +if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + target_compile_features(fmt PUBLIC cxx_std_11) +else () + message(WARNING "Feature cxx_std_11 is unknown for the CXX compiler") +endif () target_include_directories(fmt ${FMT_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC $