【问题标题】:QBS create static library for static link MSVCQBS为静态链接MSVC创建静态库
【发布时间】:2018-09-11 15:54:17
【问题描述】:

我需要将应用程序构建为带有 boost 的独立模块(已经在带有 /MT 标志的静态模式下编译)。使用 Visual Studio 17(MSVC) 我的项目由一个静态库和一个控制台应用程序组成。

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']

附加额外的参数,但我需要替换标志。有什么想法可以做到吗?

【问题讨论】:

    标签: c++ qbs msvc14


    【解决方案1】:

    cpp.runtimeLibrary: '静态'

    将标志 /MD 替换为 /MT 并在调试版本中附加“d”后缀

    【讨论】:

      猜你喜欢
      • 2020-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-30
      相关资源
      最近更新 更多