[CMake] Adding external DLLs to installer created with CPack

Eric Noulard eric.noulard at gmail.com
Mon Jul 13 07:28:07 EDT 2009


2009/7/13 Tyler Roscoe <tyler at cryptio.net>:
> On Mon, Jul 13, 2009 at 12:03:32AM +0200, Robert Matusewicz wrote:
>> everything works great except one thing. I can't fing good way to add
>> external DLLs to the installer. in my case I need QtGui4.dll,
>> QtOpenGL4.dll and libpng.dll. For now, I placed all those dlls into
>> directory that I called DLL and add this install command to
>> CMakeLists.txt
>>
>> install (FILES "D:/DLL/QtGui4.dll"
>>                      "D:/DLL/QtOpenGL4.dll"
>>                      "D:/DLL/libpng.dll"
>>                      DESTINATION bin)
>>
>> But this is obvious that not all developers will want to create this
>> folder and place in it all required DLLs.

May be they don't want to install those at all?
If they want I think they should be place in the same folder
as the applications that are using them and not in a "special" folder
don't you think ?

>> So, is there any way to check where those dlls are?

When do you want to check?
   1) When building your software?
   2) When installing it in order to avoid duplicate install?

>> I tried to look at CMakeCPack.cmake in
>> CMake source but didn't found anything.
>
> This isn't really an issue with CPack, so CMakeCPack.cmake isn't the
> right place to dig around.

Agreed.


> The FindQt4 module (which I assume you're using since you're building a
> Qt app) should have a variable telling you where the libs are. Then you
> can just refer to those as
> ${QT_LIB_DIR_OR_WHATEVER_IT'S_CALLED}/QtGui4.dll, etc. FindPNG should
> have a similar facility.

This would solve the 1) case.
The 2) case may be out of the CMake/CPack scope, but more
to installer scope.

Let me add that including third party libraries in install is fine as long as
you do not try to overwrite already installed libraries of the same kind.

I would give you two small ideas:

   1) make the third party lib install optional in your NSIS installer
       may be using CPack component support for NSIS:
       http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack

   2) When they are installed
        better install your third party lib along with your own software
        this way you may avoid to overwrite already installed lib.

   3) Checking if the required libs are already there during install
        may be the ultimate solution, but this may be difficult to do.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list