MSBUILD

相关链接

演练:使用 MSBuild 创建 Visual C++ 项目

1. 设置编译选项

要编译时向cl.exe添加编译选项, 需要使用环境变量 CL传递, 包括增加宏定义

set CL=/utf-8;/D_CRT_SECURE_NO_WARNINGS;/D_USING_V120_SDK71_;%CL%
<ClCompile>
	<AdditionalOptions>/Gw %(AdditionalOptions)</AdditionalOptions>
</ClCompile>

2. 添加链接参数

参考链接 https://learn.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-170

link.exe传递参数需要设置 LINK_LINK_环境变量

LINK environment variables

The linker recognizes the following environment variables:

  • LINK and LINK, if defined. The linker prepends the options and arguments defined in the LINK environment variable and appends the options and arguments defined in the LINK environment variable to the command line arguments before processing.

  • LIB, if defined. The linker uses the LIB path when it searches for an object, library, or other file specified on the command line or by the /BASE option. It also uses the LIB path to find a .pdb file named in an object. The LIB variable can contain one or more path specifications, separated by semicolons. One path must point to the \lib subdirectory of your Visual C++ installation.

  • PATH, if the tool needs to run CVTRES and can’t find the file in the same directory as link.exe itself. (link.exe requires CVTRES to link a .res file.) PATH must point to the \bin subdirectory of your Visual C++ installation.
    TMP, to specify a directory when linking OMF or .res files.

3. 设置工具集

#  使用xp的工具集 -m表示并行编译
msbuild.exe -p:PlatformToolset=v140_xp   -m`-t:rebuild "target.sln"
  • 13
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值