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

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?

1 Like

In my case, I got around it by doing:

FILE(GLOB dllfiles ${EXE_DIR}/*.dll )

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

1 Like

Thanks for the reply. Will give it a shot.

In CMake 3.16, there is file(GET_RUNTIME_DEPENDENCIES) that you can use to find the DLLs your application or libraries need rather than globbing them.

1 Like