Add support for CXX_STANDARD and CXX_STANDARD_REQUIRED to INTERFACE targets
Right now, there is no way to create an interface target that depends on a full C++ standard. Indeed, AFAICT, the canonical way of creating a header-only library that depends on a specific version of the standard is to use add_compile_features
and list all the features required by the library. This is silly, since 95% of the time you just want to express the fact that your library requires a compliant C++YY implementation, and listing a bunch of features is tedious.
Thus, I propose to allow something like this:
add_library(foo INTERFACE)
set_target_properties(foo PROPERTIES
INTERFACE_CXX_STANDARD 14
INTERFACE_CXX_STANDARD_REQUIRED YES
)
add_executable(bar bar.cpp)
target_link_libraries(bar foo)
Given the above, the intent is that the bar
executable gets the right CXX_STANDARD
and CXX_STANDARD_REQUIRED
properties as specified by the foo
library.