Skip to content

Commit

Permalink
CMake: Do not fail on unknown compiler features
Browse files Browse the repository at this point in the history
If CMake does not know much about a compiler, `target_compile_features` will fail. Issue a warning instead.
  • Loading branch information
glebm committed May 22, 2023
1 parent 7401fe0 commit c2080e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c2080e0

Please sign in to comment.