在相应目录中安装标题

时间:2018-12-05 06:55:39

标签: header-files qmake build-system

我正在尝试使用QMake安装库的标头。这些标头给出了层次结构顺序,该顺序也必须应用于安装目标。我当前的解决方案是添加许多目标(每个目标一个子目录):

...
headers.path = /usr/include/foo/widgets
headers_base.path = /usr/include/foo/widgets
headers_data.path = /usr/include/foo/widgets/data
headers_editors.path = /usr/include/foo/widgets/editors
...
HEADERS_BASE += \
    foo.hpp \
    bar.hpp
HEADERS_DATA += \
    data/foo.hpp \
    data/bar.hpp
HEADERS_EDITORS += \
    editors/foo.hpp \
    editors/bar.hpp
...
HEADERS += $$HEADERS_BASE \
    $$HEADERS_DATA \
    $$HEADERS_EDITORS

这是tedius和错误修剪。我想在自动工具中使用简单nobase之类的东西。像这样:

magic_HEADERS += \
    foo.hpp \
    bar.hpp
    data/foo.hpp \
    data/bar.hpp
    editors/foo.hpp \
    editors/bar.hpp

注意

拥有

HEADERS += \
    foo.hpp \
    bar.hpp
    data/foo.hpp \
    data/bar.hpp
    editors/foo.hpp \
    editors/bar.hpp

将所有标头安装在一个目录中。

1 个答案:

答案 0 :(得分:0)

如果使用以下示例更改.pro文件,则会安装标题:

HEADERS += \
    include/widgets/foo.hpp \
    include/widgets/bar.hpp \
    include/widgets/data/foo.hpp \
    include/widgets/data/bar.hpp \
    include/widgets/editors/foo.hpp \
    include/widgets/editors/bar.hpp

unix {
    headers.path = /usr/local/include
    headers.files = $$PWD/include/*

    target.path = /usr/local/lib
    INSTALLS += target headers
}