我正在编写自己的 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>
关于visual-studio-2010 - MS 构建 : Access compiler settings in a subsequent task,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4721879/