# FindPackage for using both static and shared.

**URL:** https://discourse.cmake.org/t/findpackage-for-using-both-static-and-shared/6681
**Category:** Code
**Created:** [October 17, 2022, 3:17pm UTC](https://discourse.cmake.org/t/findpackage-for-using-both-static-and-shared/6681 "2022-10-17T15:17:10Z")
**Posts on this page:** 1
**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: [October 17, 2022, 3:17pm UTC](https://discourse.cmake.org/t/findpackage-for-using-both-static-and-shared/6681/1 "2022-10-17T15:17:10Z")

</div>

If I have 23 projects all using dynamic libs and 1 using static libs from the same provider (boost)  
Do I need to call Find in each project so that 22 of them can use shared and 1 of them can USE\_STATIC ON ?

Is there a way to call find twice into an alias so I can then add aliased targets into the target\_link\_libraries

```auto
Find(foo alias SharedFoo ...

```

and

```auto
set (USE_STATIC on)
FInd(foo alias StaticFoo ...

```

ie something like

```auto
    target_link_libraries( MyTarget PRIVATE SharedFoo::core ...

```

vs

```auto
    target_link_libraries( MyTarget PRIVATE StaticFoo::core ...

```
