Skip to content

CXXCBC-639: Allow to build both static and shared libraries#707

Merged
avsej merged 3 commits intocouchbase:mainfrom
avsej:CXXCBC-639-fix-static-build
Aug 19, 2025
Merged

CXXCBC-639: Allow to build both static and shared libraries#707
avsej merged 3 commits intocouchbase:mainfrom
avsej:CXXCBC-639-fix-static-build

Conversation

@avsej
Copy link
Copy Markdown
Member

@avsej avsej commented Jan 14, 2025

To avoid issues with generation of cmake helper scripts the following changes has been made:

  • interface libraries that are used to carry compiler options and flags are declared as IMPORTED to avoid unnecessary INTERFACE_LINK dependencies for the static library

  • jsonsl, asio and couchbase_backtrace libraries are not linked as a targets, but rather as a object files directly. This is also done to avoid announcing them as a transitive dependencies. All these libraries are hidden and never exposed.

  • for other third-party dependencies do not disable install tasks, which generate export files

This patch also removes some unused cmake files (of crypto, sasl and operations/management directories).

Fixes #701

@avsej avsej requested review from a team and thejcfactor January 14, 2025 00:22
@avsej avsej force-pushed the CXXCBC-639-fix-static-build branch 2 times, most recently from e6d01ea to 001e4ef Compare January 15, 2025 22:55
@avsej avsej force-pushed the CXXCBC-639-fix-static-build branch 3 times, most recently from 2472efa to 4358ecb Compare February 14, 2025 23:50
@avsej avsej force-pushed the CXXCBC-639-fix-static-build branch 23 times, most recently from 0fc1b74 to 5f04125 Compare August 8, 2025 20:59
@avsej avsej force-pushed the CXXCBC-639-fix-static-build branch 3 times, most recently from fab7178 to 5dcba20 Compare August 9, 2025 01:00
To avoid issues with generation of cmake helper scripts the following
changes has been made:

* interface libraries that are used to carry compiler options and flags
  are declared as IMPORTED to avoid unnecessary INTERFACE_LINK
  dependencies for the static library

* jsonsl, asio and couchbase_backtrace libraries are not linked as a
  targets, but rather as a object files directly. This is also done to
  avoid announcing them as a transitive dependencies. All these
  libraries are hidden and never exposed.

* for other third-party dependencies do not disable install tasks, which
  generate export files

* the static library repackaged and all dependencies included into
  single library file, because of that some of the object files have to
  be renamed with "public_" or "columnar_" prefixes to avoid collisions.

This patch also removes some unused cmake files (of crypto, sasl and
operations/management directories).

Fixes couchbase#701
@avsej avsej force-pushed the CXXCBC-639-fix-static-build branch from 5dcba20 to 5df02fd Compare August 9, 2025 01:33
Copy link
Copy Markdown
Contributor

@thejcfactor thejcfactor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@avsej avsej merged commit df8f2e9 into couchbase:main Aug 19, 2025
40 of 46 checks passed
@avsej avsej deleted the CXXCBC-639-fix-static-build branch August 19, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue building couchbase-cxx-client in static

2 participants