Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qbs How to add @rpath to third party dependency?



  • We are using paho MQTT client and have paho.qbs file, which looks like this:

    //paho.qbs
    Product {
        qbs.installPrefix: project.installPrefix
        
       //abbreviated windows and linux groups
    
        Group {
            name: "Binaries (macOS)"
            condition: qbs.targetOS.contains("darwin")
    
            files: ["mac/lib/*"]
    
            qbs.install: true
            qbs.installDir: "bin"
        }
    
        Export {
            Depends { name: "cpp" }
    
            //abbreviated windows and linux properties
    
            Properties {
                condition: qbs.targetOS.contains("darwin")
    
                cpp.includePaths: ["mac/include"]
                cpp.dynamicLibraries: ["paho-mqtt3as", "paho-mqtt3cs"]
                cpp.libraryPaths: ["mac/lib"]
            }        
        }
    }
    

    Other libraries depend on this and everything compiles and links fine, but running an application with dependency on paho requires the working directory to be where the paho libs are located.

    Output of otool:

    //...
    Load command 22
              cmd LC_LOAD_DYLIB
          cmdsize 48
             name libpaho-mqtt3as.1.dylib (offset 24)
       time stamp 2 Thu Jan  1 01:00:02 1970
          current version 1.3.8
    compatibility version 1.0.0
    //...
    

    Is it possible to add @rpath to the load command?
    Any help is appreciated. ✌🏼


Log in to reply