BlueBrain / libsonata

A python and C++ interface to the SONATA format
https://libsonata.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
11 stars 12 forks source link

Allow `sonata::sonata_{shared,static}`. #335

Closed 1uc closed 8 months ago

1uc commented 8 months ago

When using libsonata as a submodule the targets were called sonata_{shared,static}. When using it via find_package they were called sonata::sonata_{shared,static}.

This commit introduces aliases for sonata::sonata_{shared,static}.

1uc commented 8 months ago

The issue is CMake code consuming libsonata. Those might have something like:

project(Foo)

if(FOO_FROM_SUBMODULES)
  add_subdirectory(extlib/libsonata)
else()
  find_package(sonata)
endif()

add_executable(foo foo.cpp)

# wrong when `FOO_FROM_SUBMODULES`
target_link_libraries(foo PRIVATE sonata::sonata_shared)

# wrong when `NOT FOO_FROM_SUBMODULES`
target_link_libraries(foo PRIVATE sonata_shared)