QMAKE_EXTRA_COMPILERS变量使INCLUDEPATH无效

时间:2014-06-12 17:22:38

标签: c++ qt qmake

我正在使用odb并将.pro文件添加到here

我发现读取" QMAKE_EXTRA_COMPILERS + = odb" (倒数第二个代码块的底部)似乎撤消了我的INCLUDEPATH修改。如果我评论该行,我的INCLUDEPATH再次正确,但当然我不再生成必要的odb文件。

#-------------------------------------------------
#
# Project created by QtCreator 2014-06-11T15:13:24
#
#-------------------------------------------------

QT       += core
QT       -= gui

TARGET = DataAccess
TEMPLATE = lib

DEFINES += DATAACCESS_LIBRARY
CONFIG += c++11

SOURCES += dataaccess.cpp

HEADERS +=\
        dataaccess_global.h \
    dataaccess.h \
    operator.hxx

unix:!symbian {
    maemo5 {
        target.path = /opt/usr/lib
    } else {
        target.path = /usr/lib
    }
    INSTALLS += target
}


# Boost
INCLUDEPATH += $(BOOST_RT)
#LIBS += -L$(BOOST_RT)/stage/lib/ -lboost_serialization
#LIBS += -L$(BOOST_RT)/stage/lib/ -lboost_system

# List of header files that should be compiled with the ODB compiler.
#
ODB_FILES += operator.hxx

# ODB compiler flags.
#
ODB_FLAGS = --database sqlite --profile qt/basic --generate-schema --generate-query --generate-session

# Select the database we are going to use.
#
DEFINES += DATABASE_SQLITE

# Suppress unknown pragmas GCC warnings.
#
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CXXFLAGS_WARN_ON -Wno-unknown-pragmas

# Link to the ODB runtime libraries.
#
LIBS += -lodb-sqlite
LIBS += -lodb-qt
LIBS += -lodb

# ODB compilation rules. Normally you don't need to change anything here.
#

# Add the Qt headers directory to the ODB include directory list.
#
ODB_FLAGS += -I$$[QT_INSTALL_HEADERS]

# Newer versions of QtCreator do builds in a separate directory. As a
# result, we need to append the source directory to ODB files.
#
for(dir, ODB_FILES) {
  ODB_PWD_FILES += $$PWD/$${dir}
}

odb.name = odb ${QMAKE_FILE_IN}
odb.input = ODB_PWD_FILES
odb.output = ${QMAKE_FILE_BASE}-odb.cxx
odb.commands = odb $$ODB_FLAGS ${QMAKE_FILE_IN}
odb.depends = $$ODB_PWD_FILES
odb.variable_out = SOURCES
odb.clean = ${QMAKE_FILE_BASE}-odb.cxx ${QMAKE_FILE_BASE}-odb.hxx ${QMAKE_FILE_BASE}-odb.ixx ${QMAKE_FILE_BASE}.sql
QMAKE_EXTRA_COMPILERS += odb # **<== problem line**

odbh.name = odb ${QMAKE_FILE_IN}
odbh.input = ODB_PWD_FILES
odbh.output = ${QMAKE_FILE_BASE}-odb.hxx
odbh.commands = @true
odbh.CONFIG = no_link
odbh.depends = ${QMAKE_FILE_BASE}-odb.cxx
QMAKE_EXTRA_COMPILERS += odbh

1 个答案:

答案 0 :(得分:0)

现在可以添加:

ODB_FLAGS + = -I $(BOOST_RT)(这是INCLUDEPATH I中被“无效”的库。

<。>文件中的