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.
This commit is contained in:
Gleb Mazovetskiy 2023-05-22 22:17:32 +01:00 committed by GitHub
parent ef55d4f52e
commit a54cb108d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>