I have a Qt 5 project made with qmake where I set my application version like this:
# myProject.pro
VERSION = 1.1.1
To make this variable accessable in C++ I add
DEFINES += VERSION_STRING=\\\"$${VERSION}\\\"
This works fine for Qt Creator. But is there a way to make this accessable to Visual Studio (with Qt-Plugin)? Otherwise I cannot compile the app anymore, because this obviously will not work.
QCoreApplication::setApplicationVersion(VERSION_STRING); // in Qt Creator OK
QCoreApplication::setApplicationVersion(VERSION_STRING); // in VS Error: VERSION_STRING is undefined
I have to explicitly set the app version when running the app in Visual Studio with MSVC2019_64 because the QCoreApplication::applicationVersion() otherwise would be empty whereas this is not the case if I am running the app on Qt Creator, where setting the version with qmake is sufficient and QCoreApplication::setApplicationVersion() wouldnt even be needed.