In a project with a mixture of C++ and C code in one directory, I need the -std=c++11 flag to apply for the C++ code, but not the C code. (Because that causes an error on MacOS.)
Currently I do this:
add_compile_options( -std=c++11 )
However, there don't seem to be any options on the add_compile_options() function to allow me to specify that these flags should only be used for C++ files.
In autotools this would be achieved by setting CXXFLAGS for C++ and CFLAGS for C code. Is there some way to do the same in CMake?