Add CMake Superbuild
to build Abseil static and shared libraries in one pass
#69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Historically, Abseil does not support shared libraries on Windows, and building both static and shared variants in a single workflow can be tricky. This change introduces a simplified CMake Superbuild that uses two ExternalProject calls to build static and shared libraries separately, while allowing them to coexist under the same install prefix.
The Superbuild is wrapped in a Bash script and uses Ninja Multi-Config when available to improve build speed and parallelism. This approach ensures both variants are installed in one execution without duplicating source checkout steps.
For example, this is the Bash driver to run Superbuild:
I've also added a
superbuild/CMakeLists.txt
that definesabsl_static
andabsl_shared
usingExternalProject_Add
, with separate build directories for each variant to avoid conflicts. A single install_all target is introduced to install both variants in one step, and the configuration automatically skips building the shared variant on WIN32 platforms for compatibility:If you truly want Multi-Config (not just “Ninja”), detect and prefer it:
Thanks,
Michael Mendy