Order of compilation for items inside a project

  • Thread starter Thread starter Alvin Chipmunk
  • Start date Start date
A

Alvin Chipmunk

Guest
In a C++ project (vcxproj) in have an item that produces another item. More exactly I have this:

<ClCompile Include="src\x86\win64.S">
<PreprocessSuppressLineNumbers>true</PreprocessSuppressLineNumbers>
<PreprocessToFile>true</PreprocessToFile>
</ClCompile>




So, as you can see, it runs "cl.exe /EP …" and produces win64.i as a result. This step produces win64.i successfully. Then I need to compile win64.i with Masm (ml64.exe), so I have another item in the same project:

<ItemGroup>
<ClCompile Include="src\x86\win64.S">
<PreprocessSuppressLineNumbers>true</PreprocessSuppressLineNumbers>
<PreprocessToFile>true</PreprocessToFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
<MASM Include="$(IntDir)win64.i" />
</ItemGroup>

The problem is VS always tries to compile win64.i first, so it first proceeds with win64.i item and only then with win64.S, so the compilation always fails, because win64.i doesn't exist yet. If I disable compilation of win64.i (by excluding it from the build), then ClCompile successfully produces win64.i from win64.S.

Is it possible to set the correct order for the building process? I need to instruct MSBuild somehow that compilation of win64.i must be executed after compilation of win64.S.

It's possible to set the order of compilation for projects in a solution, but is it possible to set that order for items in a project?

Continue reading...
 
Back
Top