What’s the best way to set compiler flags for all objects compiled with a given language? Basically, I’d like to use add_compile_options to set flags for a specific language. Or I’d like a best-practices approach to this:
Actually, looks like I got something wrong with the generator expression. Does anything look off with my code above?
Problems were encountered while collecting compiler information:
gcc: error: $<0:-fopt-info-vec: No such file or directory
gcc: error: $<1:-fopt-info-vec: No such file or directory
cc1: error: unrecognized command line option '-fopt-info-loop>'
g++: error: $<1:-fopt-info-vec: No such file or directory
g++: error: $<0:-fopt-info-vec: No such file or directory
cc1plus: error: unrecognized command line option '-fopt-info-loop>'
then it’s wrong, because a genex must be a single argument: for CMake, it’s just a string until generate time, and must survive as an intact string until then. So spaces in it require quoting (if you want them to appear as spaces), and lists (which you probably want in your case) must be composed using $<SEMICOLON>: