Tim
Tim

Reputation: 20360

How do I correlate build configurations in dependant vcproj files with different names?

I have a solution file that requires a third party library (open source). The containing solution uses the typical configuration names of "Debug" and "Release".

The third-party one has debug and release configurations for both DLL and static libraries - their names are not "Debug" and "Release".

How do I tell the solution to build the dependency first and how do I correlate which configuration to the dependent configuration?

That is, MyProject:Debug should build either 3rdParty:debug_shared or 3rdParty:debug_static.

UPDATE:

I do not wish to correlate from one to many. I just want to be able to pick one and stick with it. So in my case I would correlate Debug in the main project to 3rdParty:shared_debug.

How do I do that?

When I say build for the solution for debug I want the third-party stuff to build as well.

Upvotes: 0

Views: 140

Answers (2)

stijn
stijn

Reputation: 35901

I do not think there is an easy way to have a single solution configuration switch between building different project configurations; if I understand correctly, you want

mySolution:debug -> myProject:debug, 3rdParty:debug_shared, ...

and at another point in time

mySolution:debug -> myProject:debug, 3rdParty:debug_static, ...

You could manually or even via macros change the build configuration for the solution each time you build, but isn't that a bit tedious?

If you follow the Visual Studio way, you create extra solution configurations, and change the settings in the build Configuration Manager to have them match to the third-part ones.

mySolution:debug_shared -> myProject:debug, 3rdParty:debug_shared, ...
mySolution:debug_static -> myProject:debug, 3rdParty:debug_static, ...

This does not change your own project's configuration in any way, and it's relatively easy to switch between them.

Edit: if your project depends on this third-party library, then shouldn't it also need two configurations? Suppose your project wants to use the third-party static library, then the linker needs to know its name and path. On the other hand if you want to use the DLL, the linker needs to know another name/path. How do you switch between these two without having two configurations? At some point you'll have to instruct the linker which library to use, so you'll just end up with something like

mySolution:debug_shared -> myProject:debug_using_shared_3rdparty, 3rdParty:debug_shared, ...
mySolution:debug_static -> myProject:debug_using_static_3rdparty, 3rdParty:debug_static, ...

Upvotes: 1

adf88
adf88

Reputation: 4442

In the IDE there is "configuration manager" where you can stick project configurations with solution configurations. Also there is "build dependencies" tool to choose which project should be compiled first.

Upvotes: 1

Related Questions