# CMake installation of a software package that only provides headers and pre compiled libraries

**URL:** https://discourse.cmake.org/t/cmake-installation-of-a-software-package-that-only-provides-headers-and-pre-compiled-libraries/6119
**Category:** Code
**Tags:** os:linux
**Created:** [July 21, 2022, 2:03pm UTC](https://discourse.cmake.org/t/cmake-installation-of-a-software-package-that-only-provides-headers-and-pre-compiled-libraries/6119 "2022-07-21T14:03:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wolfman21](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/7bcc69/32.png) [@wolfman21](https://discourse.cmake.org/u/wolfman21)
#### Post date: [July 21, 2022, 2:03pm UTC](https://discourse.cmake.org/t/cmake-installation-of-a-software-package-that-only-provides-headers-and-pre-compiled-libraries/6119/1 "2022-07-21T14:03:47Z")

</div>

Hello,

We routinely work with a closed source software package, call it `Foo`, that is distributed as a set of C++ headers and libraries. The install process entails extracting the tarballs containing headers and libs and compiling one wrapper library. There is no pkgconfig or cmake config file provided.

Downstream libraries have been using a `FindFoo.cmake` and `find_package(Foo)` in module mode to bring in the targets from the package. This works well but has to be copied into each package that depends on Foo.

Is it possible to write a CMakeLists.txt for Foo that extracts the tarballs, compiles the wrapper lib, and produces a `FooConfig.cmake`? If so, is there an existing example folks know of that I could look at.

Thank you.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 21, 2022, 4:42pm UTC](https://discourse.cmake.org/t/cmake-installation-of-a-software-package-that-only-provides-headers-and-pre-compiled-libraries/6119/2 "2022-07-21T16:42:59Z")

</div>

> [@wolfman21](#):
>
> Is it possible to write a CMakeLists.txt for Foo that extracts the tarballs, compiles the wrapper lib, and produces a `FooConfig.cmake`? If so, is there an existing example folks know of that I could look at.

Sure. There is [the tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html) as well as blog posts around about doing it. You’ll likely need to make `INTERFACE` targets for the pre-compiled SDK components. Alternatively, you can make `IMPORTED` targets during the build as well as during the `FooConfig.cmake` that you generate.

---

<div class="post-metadata">

### Author: ![wolfman21](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/7bcc69/32.png) [@wolfman21](https://discourse.cmake.org/u/wolfman21)
#### Post date: [July 21, 2022, 5:33pm UTC](https://discourse.cmake.org/t/cmake-installation-of-a-software-package-that-only-provides-headers-and-pre-compiled-libraries/6119/3 "2022-07-21T17:33:29Z")

</div>

Thanks Ben. I’m going through the guide on `IMPORTED` targets now.

[https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html](https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html)
