cellml / libcellml

Repository for libCellML development.
https://libcellml.org
Apache License 2.0
16 stars 21 forks source link

CMake: BINDINGS_PYTHON=OFF is not taken into account when Python_Development_FOUND=OFF #1148

Closed agarny closed 1 year ago

agarny commented 1 year ago

I tried to build libCellML as a static library and without Python bindings, i.e. using something like:

mkdir build
cd build
cmake -G Ninja .. -DBINDINGS_PYTHON=OFF -DBUILD_SHARED=OFF

However, when I then try to build libCellML, I am getting several CMake errors that read:

CMake Error at src/bindings/python/CMakeLists.txt:170 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_SONAME_FILE_NAME:cellml>

  TARGET_SONAME_FILE is allowed only for SHARED libraries.

On further investigation, I noticed that it's because we test for Python_Development_FOUND rather than PYTHON_BINDINGS_AVAILABLE here. On my machine (Ubuntu 20.04 LTS), Python_Development_FOUND is equal to FALSE while Python_Development.Module_FOUND is equal to TRUE hence PYTHON_BINDINGS_AVAILABLE ends up being equal to TRUE.