@marc.chevrier Thank you for your answer.
Sure this is what the error message describe, but it does not explain “why”.
-
target_compile_features
allows the usage of generator expressions (https://cmake.org/cmake/help/latest/command/target_compile_features.html) -
$<COMPILE_LANGUAGE:...>
is allowed in generator expressions - the message states that it is allowed to be use for … compile options (no word about compile features)
- I can “set the same result” using compile options instead of compile features
So my question is perhaps more about what is the reason for the limitation.
I did not test it in the following environment, but:
There are toolchains that provides a C compiler but not a C++ compiler. I fear forcing the compile feature cxx_std_17 for C only code / projects could result in a failure.
My intention has been to use the generator expressions for a library interface that set C stuff for C usage (compiler) and C++ stuff for C++ usage (compiler) only.