Converting exemplar to a CMake INTERFACE-type library

I have a commit up to eliminate the static/shared library that beman.exemplar creates as a default:

Although my draft commit doesn’t currently do so, the idea would be to preserve the ability to create the static/shared library by configuring cookiecutter, while making that configuration no longer the default.

Many if not most Beman libraries are heavily template-based and users don’t inherently need to consume linker artifacts in order to use them.

I wanted to ask our CMake experts what they think about this idea and my draft of how exemplar would look as an INTERFACE library.

1 Like

Takeaways on this topic from today’s weekly sync:

  • We should adopt what beman.optional does currently and declare the named header set in the top-level CMakeLists.txt while populating it in include/beman/exemplar/CMakeLists.txt
  • It’s okay to unconditionally move the lines find_package(beman-install-library REQUIRED) and beman_install_library(beman.exemplar) from src/beman/exemplar/CMakeLists.txt into the top-level CMakeLists.txt regardless of whether or not we’re building an INTERFACE vs a STATIC/SHARED library
  • The location of the beman.exemplar-config.cmake.in file (in the draft, tentatively moved from src/beman/exemplar into the top level directory) requires more discussion

@vito.gamberini, what are your thoughts on the last bullet item above?

1 Like