Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild ignoring CLToolExe property in project file

I'm trying to compile Python 2.7 with clang on Windows. I thought a solution to doing this would be to specify the properties CLToolPath and CLToolExe. However, when I set these properties in the project files, msbuild seems to just ignore them and continue using the Microsoft compiler.

The weird thing is that when I specify those properties on the command line, msbuild does actually pick them up. (But due to other aspects of the way Python 2.7 is set up, the build doesn't actually succeed that way, so it doesn't solve the problem. It just proves these are the right properties.)

This is the relevant section of a project file

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
  <TargetEnvironment>X64</TargetEnvironment>
</Midl>
<Link>
  <SubSystem>Console</SubSystem>
</Link>
<ClCompile>
  <CLToolPath>C:\llvm\build\Release\bin</CLToolPath>
  <CLToolExe>clang-cl.exe</CLToolExe>
</ClCompile>
</ItemDefinitionGroup>

And this is the command line I'm using

msbuild /t:clean,build /p:Configuration=Release /p:TrackFileAccess=false /p:Platform="x64" /fileLogger pcbuild.sln

Any idea what could be causing the properties to be ignored?

like image 933
rwallace Avatar asked Nov 17 '25 08:11

rwallace


1 Answers

You're putting it to a wrong place. Find relevant PropertyGroup tag and add <CLToolExe> and <CLToolExe> to it as follows:

<PropertyGroup>
  <CLToolExe>clang-cl.exe</CLToolExe>
  <CLToolPath>C:\llvm\build\Release\bin</CLToolPath>
</PropertyGroup>
like image 186
Codeguard Avatar answered Nov 20 '25 08:11

Codeguard



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!