[solved] Force Qt-creator to rebuild one cpp-file on every build
-
Hello,
I use the
__DATE__
&__TIME__
macro to get the compile date in the about dialog box. That file is not changed very often but I would like to update the date and time to every build.Is there a good way to force to re-build of that specific file regardless the changes in it in qt-creator ?
Thank!
-
Hi,
Maybe use the creation date of the exe file? With the qApp->path you get the location of your program, then use the QFile on your exe file and read out the creation data. -
You could add a custom build step to delete the corresponding object files, before calling the compiler. Like this:
Command: rm
Arguments: -f filename.obj moc_filename.*
Working directory: %{buildDir}Then the compiler will be forced to rebuild that file.
-
Thanks guys,
I follow your idea Leonardo, but on windows, I'm not able to use del in command...
So I've create a .bat in the working directory with the line:
del /Q filename.o moc_filename.*
put the .bat in command and that's it.
-
Hi. Just for the record, on Windows:
Command: C:\Windows\System32\cmd.exe
Arguments: /C "del filename.obj moc_filename.obj moc_filename.cpp"
Working directory: %{buildDir}