I have a qtcreator project with subfolder template. The folders looks like this:
mainProject/
mainProject.pro
staticLib/
(bunch of .cpp and .h files)
staticLib.pro
testApp/
main.cpp
testApp.pro
And the mainProject.pro file:
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = staticLib \
testApp
testApp.depends = staticLib
I would like to install the static library so I added the install option in the staticLib.pro file:
headersDataFiles.path = $$LIBPATH/include
headersDataFiles.files = $$PWD/*.h
INSTALLS += headersDataFiles
libraryFiles.path = $$LIBPATH/lib
Debug:libraryFiles.files = $$OUT_PWD/debug/*.a
Release:libraryFiles.files = $$OUT_PWD/release/*.a
INSTALLS += libraryFiles
The problem is when I build the project in Qtcreator, it builds the static lib and then the application without running make install first, so the build for the app fails. And Qtcreator only lets me add build steps after qmake_all (which build both projects without installing the lib first).
So the question is, is there any way I could build staticLib project, install it and then build testApp?
EDIT: The testApp project can always be linked to the library from the output directory of the first project. But I would like to move the .a and headers files to other folder to keep the project organized. The testApp building failure it's not the problem. Sorry for the misunderstood.