I've now started to dabble with Qt and I was wondering if there was a way to get Qt Creator to automatically add variables to the project file. For example, I usually use C++11 code so it would be nice if Qt could put CONFIG += c++11
in the .pro file automatically when I start a new project. I looked around in the options but I can't make sense of some sections so maybe it's right in front of my face?
You can edit existing environment variables or add, reset and unset new variables based on your project requirements. To globally change the system environment from the one in which Qt Creator is started, select Edit > Preferences > Environment > System, and then select Change in the Environment field.
The purpose of a . pro file is to list the source files that are involved in a project. Since qmake is used for building Qt and its associated tools, it knows Qt very well and can generate rules for invoking moc, uic, and rcc.
pwd stands for Print Working Directory. It prints the path of the working directory, starting from the root. pwd is shell built-in command(pwd) or an actual binary(/bin/pwd). $PWD is an environment variable which stores the path of the current directory.
You can edit the wizard files of Qt Creator. The files are in the following directory:
Qt-Dir/Tools/QtCreator/share/qtcreator/templates/wizards/
If you look at the directory there are some folders related to different wizards. For example if you look in to the "plaincppapp/qmake" folder, there you can see a "project.pro" file which is a template pro file. You can just edit that file like:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += C++11 #added this line
SOURCES += main.cpp
Next time you create a project by that wizard, your custom pro would be created for the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With