qtqt5qbs

qbs get directory where a library is located


I have a Product:

demo.qbs

import qbs

Product {
    Depends { name: "the_library" }
}

directory the_library_set and qbs for the libraries:
the_library_set.qbs

import qbs

Project {
    name: "the_library_set"
    qbsSearchPaths: "qbs"

    references: [
        "the_library/the_library.qbs",
        ...
    ]

the_library.qbs

Product {
    Depends { name: "the_module" }
}

the_module.qbs

import qbs

Module {        
    Properties {
        // I need the path relative to the the_library_set.qbs' dir here:
        cpp.includePaths: [?]
        cpp.libraryPaths: [?]
    }
}

How can I get the path relative to the the_library_set.qbs' file dir?


Solution

  • The question seems dubious, because a module should in general not be making assumptions about the products depending on it, and especially not their locations. Likely, the respective project is ill-designed. Ignoring that issue, the path you want is accessible via product.sourceDirectory.