# install build artefacts of an external project

**URL:** https://discourse.cmake.org/t/install-build-artefacts-of-an-external-project/2791
**Category:** Usage
**Created:** [February 17, 2021, 5:11pm UTC](https://discourse.cmake.org/t/install-build-artefacts-of-an-external-project/2791 "2021-02-17T17:11:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lieven](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/c37758/32.png) [@Lieven](https://discourse.cmake.org/u/Lieven)
#### Post date: [February 17, 2021, 5:11pm UTC](https://discourse.cmake.org/t/install-build-artefacts-of-an-external-project/2791/1 "2021-02-17T17:11:19Z")

</div>

Use case:

- there is some external project that need to build stuff ancient style (configure/make/make install)
- the outcome is a few shared libraries (.so with the symlinks game, by the wat on linux)
- users of these (libraries that include the headers, and in the end want to link with these libraries) depend on a INTERFACE library
- this interface library depends on the External\_Project and connects the headers and build so files via target\_include\_directories and target\_link\_libraries on this interface library

Thanks to this the build process goes perfect. Say that some executable target in the end depends on it, during the install of that one, we could do :

install(TARGETS MyApplication FOO  
COMPONENT MyApplication)

where FOO is actually that interface library mentioned above, but this does not put the shared libraries in the installation. What is the best way to get these to join the party ?

target\_include\_directories(FOO  
INTERFACE ${CMAKE\_CURRENT\_BINARY\_DIR}/include)  
target\_link\_libraries(FOO  
INTERFACE ${CMAKE\_CURRENT\_BINARY\_DIR}/lib/libfoo.so  
INTERFACE ${CMAKE\_CURRENT\_BINARY\_DIR}/lib/libbar.so)

add\_dependencies(FOO FOO\_EP)

ExternalProject\_Add(FOO\_EP …)

Any ideas ?

---

<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: [February 17, 2021, 5:42pm UTC](https://discourse.cmake.org/t/install-build-artefacts-of-an-external-project/2791/2 "2021-02-17T17:42:52Z")

</div>

You’ll have to make `install` command calls for these files manually. I don’t know of a way to say “install this INTERFACE target as if it were the SHARED library it is representing” that is conveniently provided today.
