I am not entirely clear on what you are asking but I'll take a shot. First, there are two kinds of libraries you can build - statically linked and dynamically lined. You define which kind(s) in the project settings of the library's solution. One project file can be configured to build both of them. There are also options for debug and release mode, 32-bit or 64-bit mode, and dynamic or static linking of the run-time libraries. There is also the possibility of multi-byte character set or Unicode. In total, that is five options with two choices for each so that means you have thirty-two possibilities with just those and there can be more that you define through your own macro definitions. Enabling logging or not is one potential option you can use.
The next issue is how you tell your program which version of the library(s) to link with. I do this through what I call a library selection header file. Here is what one of mine looks like for what I call my Extension Library :
#pragma once
#define EXTENSIONLIBSEL_H
#if( _MSC_VER >= 1926 ) // VS 2019
#ifdef USE_STATIC_RTLS // using static libraries
#ifdef _M_X64
#ifdef _DEBUG
#pragma message( "linking with Extension19DMS64\n" )
#pragma comment( lib, "Extension19DMS64" )
#else // _DEBUG
#pragma message( "linking with Extension19RMS64\n" )
#pragma comment( lib, "Extension19RMS64" )
#endif // _DEBUG
#else // ! _M_X64 -> 32-bit X86
#error sorry, 32-bit mode is not supported
#endif // _M_X64
#else // USE_STATIC_RTLS // using dynamic libraries
#ifdef _M_X64
#ifdef _DEBUG
#pragma message( "linking with Extension19DMN64\n" )
#pragma comment( lib, "Extension19DMN64" )
#else // _DEBUG
#pragma message( "linking with Extension19RMN64\n" )
#pragma comment( lib, "Extension19RMN64" )
#endif // _DEBUG
#else // ! _M_X64 -> 32-bit X86
#error sorry, 32-bit mode is not supported
#endif // _M_X64
#endif // USE_STATIC_RTLS
#else
#error this version of Visual Studio is currently not supported
#endif
I usually use dynamic RTLs so to use this library with static RTLs, one must define the macro
USE_STATIC_RTLS
prior to including this file. Also,
_M_X64
must defined to use that library. I don't have options for Unicode or 32-bit more builds in this file because I never use them. Those are just implementation details for using this library. Yours can be entirely different if you want them to be - that is up to you.
Using this library with the appropriate definitions allows your application to link with which ever versions of the library(s) you use is appropriate and it does so automatically through the
#pragma
statements. I use ten different libraries and they are all set up like this and it works very well for the fifty or so programs I work on. BTW - I first saw this technique used in the UltimateGrid library that is available at this site and it is one of the libraries I use.
Hopefully this answers the question you asked.