Hi there,
I noticed a warning on linux compiling a plugin which includes a C file :
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [enabled by default]
This warning becomes an error on MacOs
This option is coming from that line (SofaFramework/CMakeLists.txt)
target_compile_options(SofaHelper PUBLIC “$<$<AND:$<NOT:$<BOOL:$<TARGET_PROPERTY:SOFA_NO_CXX11>>>,$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>>:${CXX11_FLAG}>”)
It looks like it adds the c++11 flags to a cmake whole “target” and not in specific C_FLAGS / CXX_FLAGS which control flags on a per file type basis.
I could find how to achieve this using the target_compile_options() command. Any cmake expert might have an idea ?
A workaround is to compile the c files in a separate library with no dependency to sofa and no c++11 flags.
thomas