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.
I tried to compile one of the example programs from examples using cmake. However CMake cant find libsbml using the find_package command. Could someone who has a better knowledge about cmake help to resolve this issue?
Expected behaviour
The cmake command find_package(sbml REQUIRED) successfully finds libsbml.
Observed behaviour
CMake can not find the file sbml-config.cmake and therefore can not find the library and header files of sbml. Moving the config files into a subfolder, like most libraries do it, allows cmake to find them but messes up the path variables.
Steps to reproduce
Install Ubuntu 22.10
sudo apt install libsbml5-dev
Download CMakeLists.txt and one of the examples, rename to example.cpp
I tried to track down the problem and came to the following conclusion:
The sbml-config-*.cmake files are written directly to "/urs/lib/x86_64-linux-gnu/cmake" and not into a subfolder sbml. After moving the files into this newly created subfolder a new issue occurs: The variable _IMPORT_PREFIX is set to /usr/lib and used as prefix for /lib/x86_64-linux-gnu/libsbml.so.5.19.0. Manually fixing the paths leads to the successful compilation of the example program.
I tried to compile one of the example programs from examples using cmake. However CMake cant find libsbml using the find_package command. Could someone who has a better knowledge about cmake help to resolve this issue?
Expected behaviour
The cmake command
find_package(sbml REQUIRED)
successfully finds libsbml.Observed behaviour
CMake can not find the file
sbml-config.cmake
and therefore can not find the library and header files of sbml. Moving the config files into a subfolder, like most libraries do it, allows cmake to find them but messes up the path variables.Steps to reproduce
sudo apt install libsbml5-dev
CMakeLists.txt
and one of the examples, rename toexample.cpp
mkdir build && cd build && cmake .. && make -j
Package version
Package: libsbml5-dev Status: install ok installed Priority: optional Section: libdevel Installed-Size: 32111 Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Architecture: amd64 Source: libsbml Version: 5.19.0+dfsg-1ubuntu2 Provides: libsbml-dev Depends: libsbml5 (= 5.19.0+dfsg-1ubuntu2)
cmake version: 3.24.2
Similar issues:
Probably related to Issue #245
Fixing the issue
I tried to track down the problem and came to the following conclusion: The sbml-config-*.cmake files are written directly to "/urs/lib/x86_64-linux-gnu/cmake" and not into a subfolder
sbml
. After moving the files into this newly created subfolder a new issue occurs: The variable_IMPORT_PREFIX
is set to/usr/lib
and used as prefix for/lib/x86_64-linux-gnu/libsbml.so.5.19.0
. Manually fixing the paths leads to the successful compilation of the example program.CMakeLists.txt