We can add a .lib File to a project by adding the file to a target. But I have the situation, that I would like to include one .lib File or the other .lib File dependent on how some #defines are set. So I like to specify via source code (between #ifdef ... #else .. #endif) which .lib file I like to link into my project. How can this be done? Thanks in advance for your hints. - Adrian
How can this be done?
It can't. Preprocessor #if's are several layers of tools away from the linker/librarian. There's no way for a decision result to punch through all the way.
What you can and should do in this case is define multiple targets for your project, then enable only the library you want in each of them. You can also specify different preprocessor definitions.
The location of the switch affecting both your C source code and the librarian, has to be in the top-level tool that controls all the others.
If you have access to the source code of the libraries, you could simply give the functions contained within each library a different name, include both libraries in your project and let the linker do the rest.
Thank you for your answers. I thought that it is not possible with directives. I use now the solution with multiple targets.