Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QMake: build paths and filenames with macros - import large Visual Studio solution
Schrompf last edited by
I'm in the process of porting a Windows C++ application to Linux/Mac. I'm not using Qt in this app, but QT Creator and QMake. The project is a complex solution from Visual Studio with 10+ statically linked libraries and another 10 precompiled dependencies.
I'm getting tired of replicating each and every setting in each project, so I wonder if it's possible to extract most settings into a .pri or something and code the settings there in an project-independent manner?
TARGET = MyApp_$$BUILD_CONF_$$BUILD_ARCH
OBJECTS_DIR = $$GLOBAL_ROOT_OR_SOMETHING/obj/$$PRO_FILE$$BUILD_CONF_$$BUILD_ARCH
so that when including this .pri into any of my .pros the target results in "MyApp_Debug_x64", for example, depending on the current build config and settings in the current project. And the object files should go to MySolutionRoot/obj/MyApp_Debug_x64/.
Of course this would also require that I can use the same mechanism to tell the final app project which libraries it needs to link. But I guess that if there's a macro resolve mechanism in place, I can use it everywhere.
Or maybe I'm on the wrong track here. Coming from Visual Studio I had a solution that handles the dependencies for me. I tried to mirror these dependencies with QMake/QtCreator, but upto now it has been a cumbersome task. I have a directory structure like this:
and so on. Everything required to build the whole project comes flowing from various Subversion repositories referenced via svn.external. All colleagues are able to simply check out the whole structure and build it right away. And I want to keep this for Linux builds, too.
So another question is: is there a way to specify a "root" for all projects that I can use to construct paths on? Or how do I specify include paths, dependencies and so on and commit those settings to the repositories so that they work out of the box for everyone?
Thanks for your patience. I'm pretty sure I'm way too stuck in VisualStudio-style thinking, but currently I don't see a way out that preserves the whole structure and still compiles and links correctly in the end.