# Add extra files to CPack without "install()"-ing them

**URL:** https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800
**Category:** Usage
**Created:** [March 12, 2020, 5:30pm UTC](https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800 "2020-03-12T17:30:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mathsoum](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathsoum/32/426_2.png) [@Mathsoum](https://discourse.cmake.org/u/Mathsoum)
#### Post date: [March 12, 2020, 5:30pm UTC](https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800/1 "2020-03-12T17:30:10Z")

</div>

Hi everyone,

I’m building a multi-platform library and I have the cmake && build && install process working everywhere I need it to be working.  
What I try to do now is create a NSIS packages with CPack for Windows and I would like to include the DLLs my library depends on (I’ll focus on packages for other distributions afterwards).  
The thing is, I don’t want to “install()” them because I think it’s not necessary. Here me out :

- Folks that are gonna build the lib from the sources will use the cmake && build && install process and therefore must already have their dependencies installed on their system as CMake could find them to link against.
- Folks that will install the library from the NSIS installer package may not have the dependencies installed and it’s why I want to include them in the installer so one installation brings all you need without version compatibility problems and whatever.

I did not find a way to have CPack package files that are not “install()”-ed in the CMakeLists.txt  
Is there a way to do so?  
Am I completely mistaken and that’s not the way I should use CPack?  
I heard from a Daniel Pfeifer talk (name dropping!) that he creates his own CPackConfig.cmake that includes the one generated by CMake. I have never done nor seen this yet. Is this the way that would fit my needs?

---

<div class="post-metadata">

### Author: ![Gonzalo\_Garramuno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gonzalo_garramuno/32/265_2.png) [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)
#### Post date: [March 12, 2020, 11:17pm UTC](https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800/2 "2020-03-12T23:17:48Z")

</div>

In my case, I got around it by doing:

FILE(GLOB dllfiles ${EXE\_DIR}/\*.dll )  
FILE(COPY ${dllfiles} DESTINATION ${CMAKE\_BINARY\_DIR}/…/bin )  
INSTALL( DIRECTORY ${CMAKE\_BINARY\_DIR}/…/bin DESTINATION bin )

Not sure if this is the “right” way, but it works for me.

---

<div class="post-metadata">

### Author: ![Mathsoum](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathsoum/32/426_2.png) [@Mathsoum](https://discourse.cmake.org/u/Mathsoum)
#### Post date: [March 13, 2020, 8:51am UTC](https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800/3 "2020-03-13T08:51:47Z")

</div>

Thanks for the reply. Will give it a shot.

---

<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: [March 13, 2020, 1:01pm UTC](https://discourse.cmake.org/t/add-extra-files-to-cpack-without-install-ing-them/800/4 "2020-03-13T13:01:29Z")

</div>

In CMake 3.16, there is [`file(GET_RUNTIME_DEPENDENCIES)`](https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies) that you can use to find the DLLs your application or libraries need rather than globbing them.
