How to extract library into its own CMake project

Hello,

i have a CMake project which builds among other things a shared library foo.so / foo.dll
Where can I find an example how to extract a part of this projects into its own standalone CMake project?

What would be then good practice to link to this external library?

Thanks for any help!

You’ll want to make it a project that installs its libraries, headers, and a CMake package. The Importing and Exporting Guide describes how to do this.