[Qt-creator] [SailfishDevel] DEFINES in .pro file: Changes require clean to take effect
Ziller Eike
Eike.Ziller at digia.com
Mon Sep 23 16:49:42 CEST 2013
On 10.09.2013, at 13:57, Joseph Crowell <joseph.w.crowell at gmail.com> wrote:
> I think Creator used to detect changes to the .pro file and autmatically
> ran qmake back in the 4.7ish days? Maybe we can automatically run qmake
> if the modified date/time on the .pro file is newer than a last ran
> qmake date/time (this could be stored in the .pro.user file I guess).
> I'm going ahead and ccing this to the qt-creator mailing list.
Qt Creator didn't and does not, but qmake itself writes a rule to the Makefiles to rerun qmake when the .pro file changes.
Most probably that doesn't lead to a recompilation of the unchanged main.cpp though, but one would need to have a look at the compile output to say for sure.
Br, Eike
> On 31/08/2013 07:24 PM, Lucien XU wrote:
>> Hi Christopher
>>
>> Be sure to run qmake and _rebuild_ your project when you change the defines,
>> because the change in pro file needs a recompilation in files containing the
>> #ifdef macros.
>>
>> If you run qmake and rebuild, at least you are sure that you are running the
>> files that are using the correct #ifdefs.
>>
>> Cheers,
>> Lucien
>>
>> Le samedi 31 août 2013 10:22:22 christopher.lamb at thurweb.ch a écrit :
>>> Hi all
>>>
>>> I have a DEFINES QMake directive in my project .pro file which
>>> (should) allow me to respond to this with #if #ifdef C++ preprocessor
>>> macros in my main.cpp file.
>>>
>>> Let assume I have the following
>>>
>>> //.pro file
>>> DEFINES += TEST_A
>>>
>>> //main.cpp
>>> #ifdef TEST_A
>>> //Do Something
>>> #endif
>>>
>>> #ifdef TEST_B
>>> //Do Something different
>>> #endif
>>>
>>> I build and run my code. As expected, "Something" happens, "Something
>>> different" does not.
>>>
>>> I then change the pro file
>>>
>>> DEFINES += TEST_B
>>> # DEFINES += TEST_A
>>>
>>> and build and run again. I expect "Something" to be skipped and
>>> "Something different" to happen.
>>>
>>> Instead the "Something" happens. i.e. it is as if I made no change to
>>> the .pro file.
>>>
>>> If I then clean the project, and build and run again, then I get the
>>> expected results "Something different".
>>>
>>> i.e. changes to the DEFINES setting only take effect once a project
>>> has been cleaned.
>>>
>>> I suspect that this is a more general Qt / QMake problem rather than a
>>> Sailfish specific one.
>>>
>>> I am running the Sailfish Alpha 2 (Qt5) hosted on OSX.
>>>
>>> Grüsse
>>>
>>> Chris
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Eike Ziller, Senior Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Qt-creator
mailing list