rwallace
rwallace

Reputation: 33475

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?

Upvotes: 3

Views: 1360

Answers (1)

Codeguard
Codeguard

Reputation: 7975

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>

Upvotes: 4

Related Questions