The World’s Largest Online Community for Developers

'; cross platform - C++ Multiple libraries depending on one library - LavOzs.Com

I have written a library that provides to me basic debugging functionality, that can be stripped at compile time. I have been using this library in almost all my projects, however, I have come to a situation where I have created 3 libraries in a project I am working on that all depend on the same library. Because of this, in their own subdirs, they all build the code for this debugging lib independently, and this is not optimal. I am wondering how I would go about mitigating this problem, in a cross platform fashion.

project layout:

  \__ src
  \__ foo_lib
  |      \__ src
  |      \__ debug_lib
  \__ bar_lib
         \__ src
         \__ debug_lib

If this were a git repository, which is is, I would have 2 sub-dependencies that have the debug lib as a sub-dependency. Because of this, in addition to compiling both, I would have to download both whenever cloning the repository.

My friend told me about installing a global library, but I could only figure out how to do this on my Linux machine, not Windows.

EDIT: Addendum from comment

I would like to have the ability to debug through the source of the project (ie. breakpoints and navigation through source) while developing with it, and would not like to pre-compile binaries to ship with my git repos.

  1. Is this a static library?

Compile it only 4 times (x86,x64,debug,release) then just include the .lib in all your projects and use the .h file.

#pragma comment(lib,"debuglib.lib");
  1. Is this a DLL ? You can install it in the system (bad practise).

  2. Can this be a header-only library? no need for binaries.

What are the differences between a pointer variable and a reference variable in C++?
How can I profile C++ code running on Linux?
The Definitive C++ Book Guide and List
What is the effect of extern “C” in C++?
What is the “-->” operator in C++?
Why do we need virtual functions in C++?
Easiest way to convert int to string in C++
C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?
Why is reading lines from stdin much slower in C++ than Python?