Expose libraries built with CMake as components

Some of the subprojects in out code base are built using CMake. To make those libraries available in other C++ subprojects, I currently do the following:

  • In the library subproject:
    • zip the resulting .so files
    • Add the zip artifact to a configuration
  • In the dependent subproject:
    • depend on that zip artifact
    • unzip it to a build/ subdirectory before compiling
    • specify a prebuilt library that the binary depends on

This feels like a hack to me. Is there any way to define a library component in the library subproject instead (and build that using CMake) that I can then depend on in the dependent subproject as if the library was built using gradle?