[Qt-creator] [SailfishDevel] DEFINES in .pro file: Changes require clean to take effect

Joseph Crowell joseph.w.crowell at gmail.com
Tue Sep 10 13:57:42 CEST 2013


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.

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




More information about the Qt-creator mailing list