我正在编写我自己的 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 - 微软内部版本 : Access compiler settings in a subsequent task,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4721879/