pymor / pymor-deal.II

minimal deal.II python bindings for usage with pymor (http://pymor.org/)
BSD 2-Clause "Simplified" License
10 stars 4 forks source link

[cmake] switch to standard deal.II finding method #24

Closed renefritze closed 2 years ago

renefritze commented 2 years ago

So it looks like I cannot both make my target a pybind module and use the deal macro on it.

pybind11_add_module(pymor_dealii_bindings bindings.cc)
DEAL_II_SETUP_TARGET(pymor_dealii_bindings)

Fails with

CMake Error at /usr/local/share/deal.II/macros/macro_deal_ii_setup_target.cmake:169 (TARGET_LINK_LIBRARIES):
  The keyword signature for target_link_libraries has already been used with
  the target "pymor_dealii_bindings".  All uses of target_link_libraries with
  a target must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * lib/pybind11/tools/pybind11Tools.cmake:162 (target_link_libraries)
   * lib/pybind11/tools/pybind11Tools.cmake:194 (target_link_libraries)

Call Stack (most recent call first):
  lib/CMakeLists.txt:12 (DEAL_II_SETUP_TARGET)

CMake Error at /usr/local/share/deal.II/macros/macro_deal_ii_setup_target.cmake:169 (TARGET_LINK_LIBRARIES):
  The keyword signature for target_link_libraries has already been used with
  the target "dealii_elasticity".  All uses of target_link_libraries with a
  target must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * lib/pybind11/tools/pybind11Tools.cmake:162 (target_link_libraries)
   * lib/pybind11/tools/pybind11Tools.cmake:194 (target_link_libraries)

Call Stack (most recent call first):
  lib/CMakeLists.txt:17 (DEAL_II_SETUP_TARGET)

-- Configuring incomplete, errors occurred!

I don't see an obvious solution that doesn't mean hacking either pybind/deal macro (again). Do you have an idea @DavidSCN ?

davidscn commented 2 years ago

This issue is a known one and the reason we introduced this file https://github.com/DavidSCN/mor-coupling/blob/main/cmake/pymor_deal_ii_setup_target.cmake

renefritze commented 2 years ago

Right. Apparently I wrongly remembered that the deal.II adapter used just the deal.II cmake stuff, so I removed that patched file here. https://github.com/pymor/pymor-deal.II/pull/24/commits/5971c7c8ffca8263d90f585c580442ec3b7be206 Will revert/drop.