我正在用子目录组织我的项目,并且找不到如何同时将子项目作为app和lib,让我解释一下:在合并到一个完整的应用程序之前,我有一些独立项目有几个类和一个main.cpp我用于开发和测试,现在我想使用这些类构建主项目(如果在IDE中显示会很好)并且仍然可以自己构建子项目,因为我可以编辑它们并重新开发,重新测试...设置TEMPLATE = lib防止这种情况,那我该怎么办?
devices.pro
TEMPLATE = subdirs
SUBDIRS += \
device_routines \
device_test
QMAKE_LFLAGS += -static
PRE_TARGETDEPS += device_routines
device_test.depends = device_routines
device_routines.pro
QT += core serialport concurrent
QT -= gui
CONFIG += c++11
TARGET = device_routines
CONFIG += console
CONFIG -= app_bundle
CONFIG += staticlib
TEMPLATE = lib
SOURCES += <list of sources>
HEADERS += <list of headers>
device_test.pro
QT += core serialport concurrent
QT -= gui
CONFIG += c++11
TARGET = device_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += $$PWD/../device_routines
DEPENDPATH += $$PWD/../device_routines
LIBS +=../device_routines/libdevice_routines.a
也尝试了没有结果
LIBS += -L$$OUT_PWD/../device_routines/ -ldevice_routines
PRE_TARGETDEPS += $$OUT_PWD/../device_routines/libdevice_routines.a