سؤال

I'm trying to find out how to specify flags for C sources in qmake project. I've tested the three options:

QMAKE_CFLAGS
QMAKE_CPPFLAGS
QMAKE_CXXFLAGS

QMAKE_CFLAGS is what I need. Both CPPFLAGS and CXXFLAGS are only applied to C++ sources. What I'm worried about is that even though CFLAGS works, this option is not documented. It's just not in the list of qmake options: http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html

So, how am I supposed to set C flags then?

On a sidenote, it's also weird there's no single option to set flags for both C and C++.

هل كانت مفيدة؟

المحلول

Even though QMAKE_CFLAGS is undocumented, it does not mean you cannot use it. There are so many useful variables with qmake undocumented. I would not discourage you to stop using this if you wish.

As for the C and C++ question: I think it is reasonable to set them separately as they are two different languages, but you can always set the same to both by having an interim variables or just duplicating the append statements.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top