MS Build:在后续任务中访问编译器设置 [英] MS Build: Access compiler settings in a subsequent task
问题描述
我正在编写自己的MS构建脚本,并将其导入项目文件(* .vcxproj)
我想根据动态使用的C运行时有条件地执行任务.我尝试了以下方法:
Condition = " '$(RuntimeLibrary)' == 'MultiThreadedDLL' "
但是$(RunitmeLibrary)不是属性,而是ClCompile的参数.
还有没有其他方法可以编写条件来检查运行时是动态还是静态?
致谢
您要查找的值是ClCompile项目组的元数据.使用这个:
Condition=" '%(ClCompile.RuntimeLibrary)' == 'MultiThreadedDll' "
我将此添加到vcxproj的底部,以查看当前设置是什么:
<Target Name="BeforeClCompile">
<Message Text="BeforeCompile: RuntimeLibrary=[%(ClCompile.RuntimeLibrary)]" Importance="high" />
</Target>
I'm writing my own MS build scripts which I import in the project file (*.vcxproj)
I would like to execute a task conditionally depending on the C runtime being used dynamically. I tried the following:
Condition = " '$(RuntimeLibrary)' == 'MultiThreadedDLL' "
But $(RunitmeLibrary) is not a Property but an argument to ClCompile.
Is there any other way to write a condition that checks whether the runtime is liked dynamically or statically?
Regards
The value you are looking for is metadata of the ClCompile item group. Use this:
Condition=" '%(ClCompile.RuntimeLibrary)' == 'MultiThreadedDll' "
I added this to the bottom of a vcxproj to see what the current setting was:
<Target Name="BeforeClCompile">
<Message Text="BeforeCompile: RuntimeLibrary=[%(ClCompile.RuntimeLibrary)]" Importance="high" />
</Target>
这篇关于MS Build:在后续任务中访问编译器设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!