[CMake] GetPrerequisites (Install the Qt DLL needed)

Clinton Stimpson clinton at elemtech.com
Fri Mar 26 15:57:03 EDT 2010


Have a look at http://www.cmake.org/Wiki/BundleUtilitiesExample
which uses GetPrerequisites.cmake under the covers.

Clint

On Thursday 25 March 2010 06:09:50 am Benoit wrote:
> Hello,
> 
> I am using cmake in my project and i want the install script to
> automatically find and install all the DLL that I need to run this program
> (I'm using Qt and i need QtCore.dll QtGui.dll and QtSql.dll).
> I have found reading the mailing
> list<http://www.mail-archive.com/cmake@cmake.org/msg14476.html>that it
> exist a GetPrerequisites.cmake that contains few functions to do so.
> 
> The bad thing is that I did not found any exemple on how to use it!
> 
> I've try with a simple using Qt in my project  (See below): My question
>  are:
> 
> 1 - Someone have an exemple of  get_prerequisites() function?
> 2 - the result works well but I obtain only the name of the DLL not the
>  full path? (I don't want to use find_program() after this call)
> 3 - I want this function to only run when I do a make install (is it
> possible)?
> 4 - How to add the target in an easier way?
> 5 - I have a warning that: "run in install tree instead of build tree?".
> what does that mean?
> 
> 
> 
> set(EXECNAME Server)
> add_executable(${EXECNAME} ${CPP_FILES} ${QM_FILES} ${UI_FILES} ...)
> 
> include(InstallRequiredSystemLibraries)
> install(TARGETS ${EXECNAME} DESTINATION bin COMPONENT Server)
> 
> if(WIN32)
> 
> set(TARGET_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug)
> set(PREREQ "")
> get_prerequisites(${TARGET_DIR}/${EXECNAME}.exe" PREREQ 0 1 ${TARGET_DIR}
> "")
> message(STATUS "PREREQ=${PREREQ}")
> 
> endif(WIN32)
> 
> 
> Thanks,
> 
> --
> Benoit RAT
> www.neub.co.nr
> 


More information about the CMake mailing list