For a custom build target, I would like to have full path with correct version of cl.exe which is being called in ClCompile target.
From retrieve path to cl.exe, I get it is %VCINSTALLDIR%\bin\x86\Hostx86\cl.exe
or %VCINSTALLDIR%\bin\x64\Hostx64\cl.exe
, But I do not want to write program for x84 vs x64 logic.
In VCTargets\Microsoft.CppCommon.Targets, I find that there is property ToolExe and ToolPath are being set to $(CLToolExe) and $(CLToolPath).
Overriding these properties also changed the path to compiler successfully for me, so it's correct that these are the properties names. Override Compiler in MSBuild
But when I try printing %(CL.ToolPath) or $(CLToolPath) in my custom target exec class, it prints nothing. I also looked in Visual Studio and couldn't find where it was being set.
Is there a variable which can provide cl.exe full path or is there any way I can print property ToolPath of CL Task in my custom target?