Allow compiling the dependencies as static libraries
- Dominant language
- C++
- Stars
- 14.1k
- Forks
- 2.5k
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 72
Description
**What language and solver does this apply to?**
C++, any solver (this is a CMake issue)
**Describe the problem you are trying to solve.**
I am trying to reproduce something that was still possible with version 9.10 (I think the relevant changes came in with 9.12 or 9.13): build ortools as static library, *including* having the dependencies as static library so I don't have to deal with bazillions of dynamic libraries that must all somehow be packaged and put into a place where they're found at runtime, which can be a hassle under some circumstances. The current `BUILD_SHARED_LIBS=Off` only results in `libortools.a` being static, the dependencies are basically all dynamic libraries now regardless of that flag - this is basically useless, one dynamic library more or less essentially doesn't change anything; the question, from a library consumer's point of view, is whether there are more than 0 shared libaries. In some situations, the first shared lib added is the point where certain packaging/distribution tasks become much more difficult.
In need this is mainly to make myself a working conanfile so it's easier to include or-tools in a project without including it in my repo directly; I have such a file for 9.10 but haven't updated it since then. Note that I don't request to have it all as a single static library, it could be any number of them. It was always a bit troublesome to deal with the hundreds of static libs abseil introduces on linux, but workable (mainly because the number of static libraries with dependencies between them for abseil is insane, constantly changes and link order matters on linux; I had built myself a script that automatically untangles the absolute mess of symbols and libraries that is abseil). That part should be easier with dynamic libraries, if you are able to use them, but dynamic libraries always open up other issues elsewhere (mainly, they need to be found at runtime).
**Describe the solution you'd like**
Passing the 'BUILD_SHARED_LIBS=Off' flag should propagate to dependencies, as far as that is possible.
**Describe alternatives you've considered**
I've investigated the sources and I don't see a way (short of patching the CMake files) to change the 'dynamicness' of the built dependencies.
**Additional context**
Add any other context or screenshots about the feature request here.
Contributor guide
Assessment
This issue has not been assessed yet.