Solution
You can do this with generator expressions:
target_compile_options(MyLib PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=c++14>)
Alternative
But the more platform independent way of doing it in this particular case would be to use target_compile_features()
. I’m not sure which compiler feature you’re using, so the following is only an example:
target_compile_features(MyLib PUBLIC cxx_explicit_conversions)