# Adding a link library to a module

**URL:** https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480
**Category:** Support
**Created:** [January 17, 2023, 11:14am UTC](https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480 "2023-01-17T11:14:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![djduke](https://discourse.vtk.org/user_avatar/discourse.vtk.org/djduke/32/2174_2.png) [@djduke](https://discourse.vtk.org/u/djduke)
#### Post date: [January 17, 2023, 11:14am UTC](https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480/1 "2023-01-17T11:14:42Z")

</div>

If I want to link an external library to a module I believe I need to use  
target\_link\_library(…).  
However when I try this with the Wrapping example module from the distribution I getan  
error when configuring cmake:  
target\_link\_libraries can not be used on an ALIAS target.  
The offending line from the module CMake file is  
target\_link\_libraries(Wrapping::Wrappable  
PUBLIC  
ogdf)  
If I understand correctly “Wrapping::Wrappable” is considered an alias  
so the question then becomes what do I need to add or change  
to get a name that is acceptable as the first argument of target\_link\_libraries

thanks,  
David

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 17, 2023, 1:42pm UTC](https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480/2 "2023-01-17T13:42:18Z")

</div>

~~I could be mistaken, but you might just have to remove the prefix:~~ Try using the library name:

```auto
target_link_libraries(vtkWrappable

```

---

<div class="post-metadata">

### Author: ![djduke](https://discourse.vtk.org/user_avatar/discourse.vtk.org/djduke/32/2174_2.png) [@djduke](https://discourse.vtk.org/u/djduke)
#### Post date: [January 17, 2023, 6:36pm UTC](https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480/3 "2023-01-17T18:36:56Z")

</div>

Thank you, David that worked.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [January 21, 2023, 3:02am UTC](https://discourse.vtk.org/t/adding-a-link-library-to-a-module/10480/4 "2023-01-21T03:02:53Z")

</div>

VTK’s module system provides `vtk_module_link` for this so that the module name can be used everywhere.
