LibSBML is a native library for reading, writing and manipulating files and data streams containing the Systems Biology Markup Language (SBML). It offers language bindings for C, C++, C#, Java, JavaScript, MATLAB, Perl, PHP, Python, R and Ruby.
The CMake configuration does not respect the user option "-DBUILD_SHARED_LIB=<ON/OFF>". Package managers (and users) commonly use this main configuration option to decide whether to build the project as a shared or static library. Specifically, library build systems for dependencies of R-packages expect the BUILD_SHARED_LIB option: (Windows build system, MacOS build system).
Generally, the BUILD_SHARED_LIB variable directly affects the command add_library() if no type (SHARED or STATIC) is given to the function. Instead of BUILD_SHARED_LIB, libsbml's CMake setup seems to use the non-canonical options LIBSBML_SKIP_SHARED_LIBRARY and LIBSBML_SKIP_STATIC_LIBRARY:
Although I think the libsbml-specific shared/static build config options (LIBSBMLSKIP<SHARED/STATIC>_LIBRARY) are totally fine, I would suggest enabling the widespread user option BUILD_SHARED_LIB as well, which would make libsbml also more accessible and easier to implement for developers of packages and toolchains.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Change in documentation
Checklist:
[ ] I have updated all documentation necessary.
[X] I have checked spelling in (new) comments.
Testing
[ ] Testing is done automatically and codecov shows test coverage
[X] This cannot be tested automatically
I tested the new option manually using the CMake GUI in Windows. It worked as expected: Shared library build can be skipped with the new option "-DBUILD_SHARED_LIB=OFF".
Description
The CMake configuration does not respect the user option "-DBUILD_SHARED_LIB=<ON/OFF>". Package managers (and users) commonly use this main configuration option to decide whether to build the project as a shared or static library. Specifically, library build systems for dependencies of R-packages expect the
BUILD_SHARED_LIB
option: (Windows build system, MacOS build system).Generally, the
BUILD_SHARED_LIB
variable directly affects the commandadd_library()
if no type (SHARED
orSTATIC
) is given to the function. Instead ofBUILD_SHARED_LIB
, libsbml's CMake setup seems to use the non-canonical optionsLIBSBML_SKIP_SHARED_LIBRARY
andLIBSBML_SKIP_STATIC_LIBRARY
:https://github.com/sbmlteam/libsbml/blob/a3e217851f18d3c5e8e2b0082fb98176738491e8/src/CMakeLists.txt#L512C1-L513C2 https://github.com/sbmlteam/libsbml/blob/a3e217851f18d3c5e8e2b0082fb98176738491e8/src/CMakeLists.txt#L462C1-L464C2
Motivation and Context
Although I think the libsbml-specific shared/static build config options (LIBSBMLSKIP<SHARED/STATIC>_LIBRARY) are totally fine, I would suggest enabling the widespread user option
BUILD_SHARED_LIB
as well, which would make libsbml also more accessible and easier to implement for developers of packages and toolchains.Types of changes
Checklist:
Testing