[CMake] Ninja, Windows resource files and add_definitions()
Johan Holmberg
johan556 at gmail.com
Tue Aug 21 11:35:37 EDT 2012
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
More information about the CMake
mailing list