On sexta-feira, 17 de janeiro de 2014 21:20:29, Till Oliver Knoll wrote: > Am 17.01.14 00:55, schrieb Thiago Macieira: > > On sexta-feira, 17 de janeiro de 2014 00:07:07, Till Oliver Knoll > > > > wrote: > >> QMAKE_CXXFLAGS += -fobjc-arc QMAKE_CFLAGS_DEBUG += -fobjc-arc > >> QMAKE_CFLAGS_RELEASE += -fobjc-arc > >> > >> > >> That is, the expected -fobjc-arc flag is only applied for > >> clang++. > > > > "CXXFLAGS" applies to C++ and Objective C++. > > Are you /sure/ you mean CXXFLAGS and not QMAKE_CXXFLAGS? In fact, I > just tried setting CXXFLAGS and it does not seem to have any effect: > > CXXFLAGS += -fobjc-arc
It was QMAKE_CXXFLAGS. What I meant is that, in general, "CXXFLAGS" in Makefiles and other buildsystem related tools related to C++. CFLAGS applies to C. And CPPFLAGS is about the C preprocessor. > -> the compiler flag is /not/ added, neither when compiling my ObjC++ > *.mm files (as expected), nor to my C++ *.cpp files. > > QMAKE_CXXFLAGS += -fobjc-arc > > on the other hand /does/ add that option when compiling my C++ files, > but naturally enabling Automatic Reference Counting (ARC - a feature > which makes only sense when compiling Objective C/C++) has no effect > in the C++ world. Good. I feared it would generate a compiler error "no such option for this file". > According to > > http://qt-project.org/doc/qt-5/qmake-variable-reference.html > > the variable QMAKE_CFLAGS does not exist (at least it is not > documented). So I assume that it would work for C files in analogy to > how QMAKE_CXXFLAGS works for compiling C++ files (which /is/ documented). It does exist and is used throughout the qmake source code and .prf files. It appears not to be documented, though, like most of qmake. > > Note that this will get the flags for plain C and C++ sources too. > > No, setting > > QMAKE_CFLAGS += -fobjc-arc > > has no effect, neither on the *.mm nor on the *.cpp files. At least > that flag was not set when clang++ was invoced. And to be honest, I > would not expect flags set for a C compiler to take effect when > compiling C++ sources either. It shouldn't. That variable should only affect *.c and *.m (which get "clang", not "clang++" run). > > I don't see an equivalent flag for ObjC++. > > I don't see e.g. QMAKE_OBJECTIVE_CXXFLAGS either (and it does not work). > > But when you mention "see" you probably refer to various Qt project > *.pro files, GIT commit messages of "Chromium" etc., as in When I mean "see", I mean doing this search in qtbase: git grep OBJECTIVE_CXXFLAGS -- mkspecs qmake If you want to do any advanced thing with qmake, you need to read those two dirs and see what they do. There's a lot of undocumented code. Which can break in the next version, because it's undocumented. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest