gismo icon indicating copy to clipboard operation
gismo copied to clipboard

Consider creating namespaced CMake targets

Open cheinigk opened this issue 4 years ago • 2 comments

Hi all,

modern CMake is all about targets, which carry all the important dependency information. With proper targets defined, including G+SMO in ones project is quite simply done by

find_package(gismo REQUIRED CONFIG)
target_link_libraries(myapp PRIVATE gismo::gismo)

Right now, I can fake this behavior by creating an imported target myself with

add_library(gismo::gismo SHARED IMPORTED GLOBAL)
set_target_properties(gismo::gismo PROPERTIES
  INCLUDE_DIRECTORIES "${GISMO_INCLUDE_DIRS}"
  IMPORTED_LOCATION "${GISMO_LIBRARY_DIR}/libgismo.so")

However, there might be compile flags or what not that is not handled and in general the proper way would be for G+SMO to provide the target.

All the best, Christian

cheinigk avatar Sep 27 '21 16:09 cheinigk

Hi Christian, thank you for this suggestion, we will try to incorporate it. You are also mostly welcome to attempt to add the namespaced target and make a PR

filiatra avatar Sep 27 '21 16:09 filiatra

@filiatra is this still relevant, or will it be improved in PR #510 ?

hverhelst avatar Oct 14 '22 14:10 hverhelst