Our product requires a static library (.lib) file to be linked as part of a Vendor's API.
I have a project defined for the API which supplies a number of functions & classes, and that generates a .lib file.
But for that .lib to link and be used by a client, it also needs to link against this static presupplied .lib from the Vendor.
So the dependency tree is:
My App -> API Wrapper Lib -> Static Lib
I can trivially tell VS that My App is dependent on API Wrapper Lib - and so My App will link against the .lib file produced by API Wrapper Lib. But it fails to link against the vendor's static lib file.
Under linker settings in My App, I can add "additional dependencies" and name "Static.lib" as a dependency - and then add "additional directories" and specify the folder where that static lib lives.
This works.
I can alternately use:
#pragma comment(lib, "static.lib")
in the main header for API Wrapper Lib which is referenced by My App. This obviates the need for an "additional dependencies" setting in My App. However, this won't work unless I still specify the "additional directories" to name the folder where "static.lib" lives, even though it lives in the same folder with API Wrapper Lib on which it is already dependent.
My question is: is there an easier way to design API Wrapper Lib so that it embeds static.lib within itself, or automatically tells the linker "hey, when folks link against my .lib, make sure you also look to "static.lib" to resolve any missing symbols"
Or something like that..
The #pragma comment(lib, ...)
is cool - but I still have to pollute the My App project with a special reference to the wrapper folder in addition to telling it "you're linkage dependent on the wrapper library".
Seems redundant and messy - always better to have one thing to set - preferably set by the wrapper library so that everything is take care of at that end - and the client need only include and specify dependency on the one thing.
Help!