Using dynamic runtimeLibrary despite "static" in cpp.runtimeLibrary in qbs profile

139 Views Asked by At

I have some qbs project and I've met with some strange behavior of linking with runtime library.

I used Qt static libraries and custom modules

//---------MyQtGuiApplication.qbs
import qbs

MyQtApplication {
    Depends { name: "Qt.gui" }
    Depends {
        name: "Qt"
        submodules: Qt.gui.defaultQpaPlugin
        condition: linkDefaultQpaPlugin && Qt.gui.defaultQpaPlugin
    }
    property bool linkDefaultQpaPlugin: Qt.gui.isStaticLibrary
}


//---------MyQtApplication.qbs
import qbs

MyNativeBinary {
    type: ["application"]

    Depends { name: "Qt.core" }
}


//---------MyNativeBinary.qbs
import qbs
import qbs.Environment

NativeBinary {
    Depends { name: "cpp" }
    property bool err: console.error(name + "______" + cpp.runtimeLibrary)
}

And simple example

//---------test.qbs
import qbs

Project {
    MyQtGuiApplication {

        name: "test"

        Depends { name: "cpp" }
        // cpp.runtimeLibrary: "static"

        files: ["*.h", "*.cpp", "*.ui", "*.qrc", "*.rc"]
    }
}

I clearly defined profiles.windows-x86-msvc14.cpp.runtimeLibrary: "static", and it isn't override by inheritance or qbs files. But if I dont define it in qbs files, I get

error LNK2038: mismatch detected for 'RuntimeLibrary'

I'd like to save modularity and not duplicate this parameter. Have you any idea, why is this happening?

0

There are 0 best solutions below