# Installing Dependencies.

**URL:** <https://discourse.cmake.org/t/installing-dependencies/7242>\
**Category:** Code\
**Tags:** os:linux, os:windows\
**Created:** [January 13, 2023, 7:20pm UTC](https://discourse.cmake.org/t/installing-dependencies/7242 "2023-01-13T19:20:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshanab](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jshanab/32/2555_2.png) [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Post date:** [January 13, 2023, 7:20pm UTC](https://discourse.cmake.org/t/installing-dependencies/7242/1 "2023-01-13T19:20:53Z")

</div>

I am trying to use the RUNTIME\_DEPENDENCY system to install the shared libraries and dlls that have been linked to in my project. But just those.

Our build server puts our builds in an opt folder, either /opt or c:/opt and I link thru various import and module or config normal methods.

I cannot find information on what each of the Pre and Post Include and exclude regexs are and have been unsuccessful in linux especially getting it to not include a bunch of extra dependencies it should not.

Can I exclude all "_" then include /opt/_

---

<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:** [January 15, 2023, 2:40am UTC](https://discourse.cmake.org/t/installing-dependencies/7242/2 "2023-01-15T02:40:56Z")

</div>

`PRE` lists are used to ignore references coming from scanned files. `POST` lists are used to handle recursion on matching library dependencies. It should be enough to use `POST_INCLUDE_REGEXES /opt/.*` to handle this case.

---

<div class="post-metadata">

**Author:** ![jshanab](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jshanab/32/2555_2.png) [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Post date:** [January 19, 2023, 9:06pm UTC](https://discourse.cmake.org/t/installing-dependencies/7242/3 "2023-01-19T21:06:30Z")

</div>

I still cannot get this to NOT include all the libs in the system including libc

---

<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:** [January 20, 2023, 2:45am UTC](https://discourse.cmake.org/t/installing-dependencies/7242/4 "2023-01-20T02:45:39Z")

</div>

Hrm. Some debugging support for the logic would be useful I suppose (akin to `--debug-find`).

---

<div class="post-metadata">

**Author:** ![jshanab](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jshanab/32/2555_2.png) [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Post date:** [January 20, 2023, 3:00am UTC](https://discourse.cmake.org/t/installing-dependencies/7242/5 "2023-01-20T03:00:34Z")

</div>

I added a PRE\_EXCLUDE on /lib to exclude the system and got rid of the libc and such.

It exposed and interesting point in that it is actually ignoring my installed openssl build and grabbing the one in the OS so those disappeared from the install.

A little coffee in the morning should fix that right up.

---

<div class="post-metadata">

**Author:** ![jshanab](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jshanab/32/2555_2.png) [@jshanab](https://discourse.cmake.org/u/jshanab)\
**Post date:** [January 22, 2023, 12:16am UTC](https://discourse.cmake.org/t/installing-dependencies/7242/6 "2023-01-22T00:16:11Z")

</div>

I have scrapped this idea, It is way to much like File GLOBing and as soon as I fixed one I had the side effect of breaking another. Very Very fragile.

IMHO, This should not be dnoe this way, using dumpbin/ldd can easily introduce errors.

I have specified all paths, and found all libs, that list should be translatable into dll/so names.

Perhaps this really should be the package maintainer responsibility, A target property like libraries and includes. i,e, INSTALL( FILES {FOO}\_INSTALL\_DEPENDENCIES) DESTINATION .)

In the Linux world it would probably be better if I made them dependencies of the package system but for now I am just going to use install (FILES… with generator expressions as needed using the variables used for finding the dependencies. It is simple, deterministic and will get the job done.

( at least until I cross compile…)

12+ hours fighting this automatic feature, \< 1 hour to just do it manually. It is a small project.
