Add a CMake option to build Intel LIBBID as a shared library instead of always statically linking it.
Motivation:
libdecimal is header-only, but it currently forces LIBBID to be built and installed as libbid_static.a. Some deployment models (e.g., multiple executables or language bindings in the same process) benefit from sharing the LIBBID runtime via a single .so/.dylib.
Proposed behavior:
Introduce a top-level option:
option(libdecimal_BUILD_SHARED_LIBS "Build Intel LIBBID as a shared library" OFF)
- When
OFF (default): keep the current behavior — static libbid_static.a.
- When
ON: build libbid.so / libbid.dylib / libbid.dll and install it as a runtime library.
Scope and constraints:
- The
libdecimal target itself remains INTERFACE/header-only.
- The exported target should remain usable as
libdecimal::libdecimal regardless of this option.
- Windows support may require
WINDOWS_EXPORT_ALL_SYMBOLS or may be documented as unsupported if LIBBID lacks __declspec(dllexport/dllimport) annotations.
- Existing default builds must be unchanged.
Acceptance criteria:
Add a CMake option to build Intel LIBBID as a shared library instead of always statically linking it.
Motivation:
libdecimal is header-only, but it currently forces LIBBID to be built and installed as
libbid_static.a. Some deployment models (e.g., multiple executables or language bindings in the same process) benefit from sharing the LIBBID runtime via a single.so/.dylib.Proposed behavior:
Introduce a top-level option:
OFF(default): keep the current behavior — staticlibbid_static.a.ON: buildlibbid.so/libbid.dylib/libbid.dlland install it as a runtime library.Scope and constraints:
libdecimaltarget itself remainsINTERFACE/header-only.libdecimal::libdecimalregardless of this option.WINDOWS_EXPORT_ALL_SYMBOLSor may be documented as unsupported if LIBBID lacks__declspec(dllexport/dllimport)annotations.Acceptance criteria:
libbid_static.aand all tests pass.cmake -Dlibdecimal_BUILD_SHARED_LIBS=ON ...produces a shared library and installs it.find_package(libdecimal REQUIRED)and link againstlibdecimal::libdecimalin both modes.