use target_compile_features to use c++11 if cmake > 3.8

If target_compile_features is available and cxx_std_11.
This fix compilation with clang and gcc when c++11 isn't specified by user.
This commit is contained in:
Olivier Ldff 2020-04-11 16:44:37 +02:00 committed by Olivier LDff
parent aee0f9d9b5
commit 131878ce9e

View File

@ -188,6 +188,10 @@ function(cxx_library_with_type name type cxx_flags)
endif()
target_link_libraries(${name} PUBLIC ${threads_spec})
endif()
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
target_compile_features(${name} PUBLIC cxx_std_11)
endif()
endfunction()
########################################################################