I am creating a function in a .pri file that will be included in a .pro file with the intent of being able to do:
template(subdirs)
addMyProject(libA)
addMyProject(libB)
addMyProject(libC)
instead of
template(subdirs)
SUBDIRS += libA
libA.path = source/
SUBDIRS += libB
libB.path = source/
SUBDIRS += libC
libC.path = source/
Same problem if I want to use the depend keyword.
My current implementation is the following one:
defineTest(addMyProject) {
library_name = $$1
SUBDIRS += $$library_name
export(SUBDIRS)
{$$library_name}.file = {$$library_name}/source/{$$library_name}.pro
QMAKE_EXTRA_TARGETS += {$$library_name}
export(QMAKE_EXTRA_TARGETS)
}
The SUBDIRS part is ok. I have tried to make it work for the .file part in different ways, but still I have not found a solution.
Any hints?
[EDIT]
Each library contains different sub-projects, and the goal is to let Qt creator see only one of them (the one at the path source/libraryname.pro). The issue is that all the libraries are correctly displayed, but also all the other sub-projects. Basically, only the SUBDIRS variable is recognised, but not the .file keyword)