prom85
prom85

Reputation: 17828

Define user macros in different property sheet

Is it somehow possible to do following:

branch.prop:

// excerpt
<PropertyGroup Label="UserMacros">
    <Branch>Trunk</Branch>
</PropertyGroup>

And another property sheet, common.prop:

// excerpt
<PropertyGroup>
    <OutDir>D:\output\$(Branch)\VW$(VW_VERSION)\$(KN_BUILD)\</OutDir>
    <IntDir>D:\output\$(Branch)\VS_Output\$(VW_VERSION)\$(KN_BUILD)\$(ProjectName)\</IntDir>
</PropertyGroup>

Problem

The problem is, that I use both property sheets in my project and if I show my projects properties I see that it shows the correct output directory and intermediate directory (like e.g. ' D:\output\Trunk\VW2016\Debug\' ) but when I compile my project it does not work, meaning that the user macro is missing so that logs show lines like following:

Library "D:\output\\VS_Output\2016\Debug\SomeProject\SomeProject.lib" ...

Pay attention to \\ instead of \Trunk\ in the log line!

Is there some way that property sheets work with user macros defined in different property sheets? Something like nesting them e.g. or any other trick?

I want to avoid to define my output directory and intermediate directory in each project manually (which would work)...

NOT WORKING ALTERNATIVE IDEAS

Why do I need this

I need this because I'm forced quite often to switch between trunk and a branch to create a hotfix and so want to avoid long build times because of overwriting intermediate / output files...

Upvotes: 1

Views: 409

Answers (1)

king_nak
king_nak

Reputation: 11513

You can import your branch.prop in common.prop, like this:

<ImportGroup Label="PropertySheets" >
    <Import Project="branch.prop"/>
</ImportGroup>

Upvotes: 1

Related Questions