# Proper way to package a library that is not cmakefied into the extension

**URL:** <https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025>\
**Category:** Support\
**Tags:** extensions-manager, package\
**Created:** [February 5, 2018, 6:08pm UTC](https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025 "2018-02-05T18:08:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![leochan2009](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leochan2009/32/519_2.png) [@leochan2009](https://discourse.slicer.org/u/leochan2009)\
**Post date:** [February 5, 2018, 6:08pm UTC](https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025/1 "2018-02-05T18:08:43Z")

</div>

Dear Slicer developers,

i have a question regarding the extension packaging.  
Currently i have an external added library in my extension, the external added library is not cmakefied.  
Basically i just download the library and header file and linked to my extension.  
For the cmakefied projects, we use CPACK\_INSTALL\_CMAKE\_PROJECTS to add the library into the package.  
What about the non-cmakefied library, are there any variable i could set to include the library into the package?  
Your suggestions are appreciated!

Best,  
Longquan

---

<div class="post-metadata">

**Author:** ![leochan2009](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leochan2009/32/519_2.png) [@leochan2009](https://discourse.slicer.org/u/leochan2009)\
**Post date:** [February 5, 2018, 9:35pm UTC](https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025/2 "2018-02-05T21:35:27Z")

</div>

never mind.  
I think the OpenSSL library in Slicer seems to be a good example to look into. 🙂

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [February 5, 2018, 10:24pm UTC](https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025/3 "2018-02-05T22:24:41Z")

</div>

For only one platform (assuming Windows), you could either use `add_custom_command`, or use ExternalProject which can run arbitrary commands. For multiple platforms it will get a little tricky because you have to do everything in cmake, and need to handle extension and package layout differences.

---

<div class="post-metadata">

**Author:** ![leochan2009](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/leochan2009/32/519_2.png) [@leochan2009](https://discourse.slicer.org/u/leochan2009)\
**Post date:** [February 6, 2018, 12:47am UTC](https://discourse.slicer.org/t/proper-way-to-package-a-library-that-is-not-cmakefied-into-the-extension/2025/4 "2018-02-06T00:47:03Z")

</div>

Hi Isaiah,

Thanks for your suggestion.  
I am looking into the file:  
I think they are using exactly the same method as you mentioned!  
Just test the installation, it is working for Mac OS!  
Still need to fix a lot of things for other platform.  
Best,  
Longquan
