c++qbsmsvc14

QBS create static library for static link MSVC


I need build application as standalone module with boost(already complied in static mode with /MT flag). Using Visual studio 17(MSVC) My project consists of a static library and a console application.

import qbs 1.0

Project {
    property string SDK: ''
    Product {
        name: 'MyLib'
        type: 'StaticLibary'
        Depends {name: 'cpp'}
        Group {
            name: 'src'
            files: './src/*.cpp'
        }
        Group {
            name: 'include'
            files: './include/MyLib/*.cpp'
        }
        cpp.cxxLanguageVersion: 'c++11'
        Properties {
            condition: qbs.toolchainType.contains('msvc')
            cpp.cxxFlags: ['/MT'] //don't replace default compiller flag /MT
        }
    }
    Product {
        name: 'app'
        type: 'ConsoleApplication'
        Depends {name: 'cpp'}
        Depends {name: 'MyLib'}
        cpp.cxxFlags: ['/MT']
        //othre depends from boost and CPP
    }
}

cpp.cxxFlags: ['/MT']

append extra param,but I need replace flag. Any ideas how I can do it?


Solution

  • cpp.runtimeLibrary: 'static'

    replace flag /MD to /MT and append 'd' suffix in debug build