Snap with C++ libraries having cmake interface

Hi,

I have a C++ library with .so file, headers, cmake config files. The structure on install rules is the following:

  • /usr/lib/x86_64-linux-gnu/ with library.so
  • /usr/include/library_headers/*.hpp
  • /usr/lib/x86_64-linux-gnu/library0/library-config.cmake

I’m trying to use such package in library sample snap, but sample fails to find library-config.cmake. How to make sample snap aware of location of cmake config? On conda and apt levels, it will work out of box…

I suppose I also need to connect libraries and sample, for this I did slots for library snap:

slots: library0-1: interface: content content: library0-1 read: - $SNAP/usr/lib

But not sure whether it will work. In general snapcraft has quite poor documentation about interfaces, no any example how to connect simple packages just sharing the read-only data.

Thanks, Ilya.