qmake .pro file INCLUDEPATH issue
-
In the qmake .pro file, I am including QGIS libraries like following:
QGIS_DIR = /home/unibw/dev/QGIS BUILD_DIR = /home/unibw/dev/cpp/QGIS-Debug-Build LIBS += -L$${BUILD_DIR}/output/lib -lqgis_app -lqgis_core -lqgis_gui INCLUDEPATH += $$BUILD_DIR INCLUDEPATH += $$BUILD_DIR/src/core INCLUDEPATH += $$BUILD_DIR/src/gui INCLUDEPATH += $$QGIS_DIR INCLUDEPATH += $$QGIS_DIR/src/core INCLUDEPATH += $$QGIS_DIR/src/core/settings INCLUDEPATH += $$QGIS_DIR/src/core/providers INCLUDEPATH += $$QGIS_DIR/src/core/geometry INCLUDEPATH += $$QGIS_DIR/src/core/proj INCLUDEPATH += $$QGIS_DIR/src/core/metadata INCLUDEPATH += $$QGIS_DIR/src/core/symbology INCLUDEPATH += $$QGIS_DIR/external/nlohmann INCLUDEPATH += $$QGIS_DIR/src/core/expression INCLUDEPATH += $$QGIS_DIR/src/core/project INCLUDEPATH += $$QGIS_DIR/src/core/vector INCLUDEPATH += $$QGIS_DIR/src/core/editform INCLUDEPATH += $$QGIS_DIR/src/gui INCLUDEPATH += $$QGIS_DIR/src/core/labeling INCLUDEPATH += $$QGIS_DIR/src/core/raster INCLUDEPATH += $$QGIS_DIR/src/core/layertree INCLUDEPATH += $$QGIS_DIR/src/core/textrenderer
However, I don't understand why writing only for example
INCLUDEPATH += $$QGIS_DIR/src/ INCLUDEPATH += $$QGIS_DIR/external
Or even just writing
INCLUDEPATH += $$QGIS_DIR
doesn't work? Shouldn't qmake find the libraries automatically? Why do I need to write every single path to every header files explicitly?
-
@korai said in qmake .pro file INCLUDEPATH issue:
Shouldn't qmake find the libraries automatically?
No, and you don't define libraries here but include paths for the compiler.
-
@Christian-Ehrlicher thank you for your reply. Is it the correct way to do? I mean, should I write every single path explicitly? I would expect that
INCLUDEPATH += $$QGIS_DIR/src/core
should work also for other paths beginning with $$QGIS_DIR/src/ for instance:
INCLUDEPATH += $$QGIS_DIR/src/core/settings INCLUDEPATH += $$QGIS_DIR/src/core/providers INCLUDEPATH += $$QGIS_DIR/src/core/geometry ...
-
@korai said in qmake .pro file INCLUDEPATH issue:
should work also for other paths beginning with $$QGIS_DIR/src/ for instance:
I don't know where the QGIS headers are, you have to add those include dirs where the headers you're using are in.
-
For example, QGIS header files are ordered as follows:
-QGIS -src -core qgsapplication.h -settings qgssettings.h -maprenderer qgsmaprenderertask.h
When I include QGIS/src/core, then it only includes qgsapplication.h, but I would expect that it includes also qgssettings.h and qgsmaprenderertask.h header files, because they are in the subdirectories(settings and maprenderer) of the core directory. Is there a flag or something to include paths recursively?
-
Hi,
No there's not.
Either you include the subfolder as part of your include statements or you give additional paths to your INCLUDEPATH like you currently do.