Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Build: Access compiler settings in a subsequent task

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

like image 228
niks Avatar asked Dec 01 '25 15:12

niks


1 Answers

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>
like image 124
Brian Walker Avatar answered Dec 04 '25 16:12

Brian Walker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!