[CMake] Ninja, Windows resource files and add_definitions()

Peter Kümmel syntheticpp at gmx.net
Sun Aug 26 13:48:24 EDT 2012


On 21.08.2012 17:35, Johan Holmberg wrote:
> Hi!
>
> I just tried to build my project with CMake + Ninja for the first
> time. I use Visual Studio 2008 on Windows. Everything went well except
> when the resource files were compiled (by "rc").
>
> I have a number of "add_definitions()" commands in my CMakeLists, for example:
>
>      add_definitions( /Za )
>
> These flags (e.g. "/Za") are propagated to "rc", and it gives an error
> when using Ninja. But when I generate a Visual Studio project with
> CMake, flags known to "cl" but not to "rc" seem to be filtered out, so
> even the "rc" invocations work, and my project builds without errors.
>
> Is this what I should expect? Or should the Ninja generator also
> detect those options an filter them out?
>
> Perhaps I should move to using variables such as "CMAKE_CXX_FLAGS"
> instead, and the file property "COMPILE_FLAGS"? But until now I have
> felt that "add_defintions" was a convenient way to add non -D options
> too (and the documentation says "This command can be used to add any
> flags, but it was originally intended to add preprocessor
> definitions").
>
> /Johan Holmberg


http://public.kitware.com/Bug/view.php?id=13486

This bug is fixed in the next release, our use stage/next.

Peter


More information about the CMake mailing list