QMake subdir模板输出到构建目录而不是主目录

时间:2017-12-29 20:18:52

标签: qt qmake

我正在尝试使用qmake的subdirs模板。问题是子项目中指定的输出目录是在构建目录中创建的,而不是在项目中引用的目录。除此之外一切正常。我想知道是否有办法解决这个问题。

目录结构

 build-project_dir/
   -Apps/ --this gets created
   -Other things
 project_dir/
    -main.pro
    -Apps/ -- I want it to use this instead
    -Server/
    ----Server.pro
    ----some logic files
    -Parser/
    ----Parser.pro
    ----Parser files
    -muparser/
      -build/
       ----muparser.pro
       ----main.cpp

Main.pro

TEMPLATE = subdirs

# where to find the sub projects - give the folders
Server.subdir = Server
Parser.subdir = Parser
muparser.file = muparser-2.2.5\build\muparser.pro

# what subproject depends on others
Server.depends = Parser
Parser.depends = muparser


SUBDIRS = muparser Parser Server

Server.pro

TEMPLATE = app

QT       += core sql websockets xml
QT       -= gui

TARGET = Server

CONFIG   += console
CONFIG   -= app_bundle
CONFIG   += thread


SOURCES += $$files(src/*.cpp, true) $$files(src/*.c, true)
HEADERS += $$files(src/*.h, true)
INCLUDEPATH += src src/things/include

LIBS += -L../lib -lParser

DESTDIR = ../Apps

Parser.pro

TEMPLATE = lib
QT       -= gui

TARGET = Parser

DEFINES += PARSER_LIBRARY

SOURCES += parser.cpp     
HEADERS += parser.h

INCLUDEPATH += ./include 

DEPENDPATH += $$PWD/./

LIBS += -L../lib -lmuparser
DESTDIR += ../lib
DLLDESTDIR += ../Apps

原因是因为那里需要DLL。

1 个答案:

答案 0 :(得分:0)

感谢Bill我能够找到解决问题的方法

我只需将应用的DESTDIR位置更改为DESTDIR = $$_PRO_FILE_PWD_/../Apps_Win

即可