[CMake] swig - how do I set compile flags on the generated files?

Miller Henry MillerHenry at JohnDeere.com
Tue Nov 27 18:11:24 EST 2012


Our normal coding standards requires zero warnings with -wall -wextra  (gcc/clang), but often the swig generated file has warnings.   We don't mind turning these warnings off for the generated file, but we still want to see them for other files in the project.  However I'm stumped on how to do this.

Currently I have

ADD_DEFINITIONS(-Wno-unused-parameter ...)

 which works but it disables the warning for non-generated files as well.

I understand the right way to do this is by:

Set_source_files_property(filename PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter  ...")

However I don't have filename.  Instead I have myInputfile.i, which gets turns into something like myInputFilePYTHON_wrap.cxx.  Of course I can generate this name, but that seems fragile: if cmake desides to change the file mangling in the future I need to change my algorithm.

So the question is either: is there are good way to get the generated filename, or is there a different way I should be doing this?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121127/29e321b1/attachment.htm>


More information about the CMake mailing list