[CMake] Get Qt DLL paths for INSTALL

Mike Jackson imikejackson at gmail.com
Wed Jun 18 13:01:42 EDT 2008


I hacked together the following: Note the variable  
MXATools_PROJECT_DIR is defined in another cmake file and basically  
points to the top level Project folder.


#  
------------------------------------------------------------------------ 
------
# This CMake code installs the needed support libraries on NON OSX  
platforms
#  
------------------------------------------------------------------------ 
------

# ---------- Find/Install the needed Qt4 libraries. This was taken  
directly from
# -- the ParaView 3.x cmake files. This is NOT my original code  
----------------
SET (QTLIBLIST QtCore QtGui)
IF (CMAKE_BUILD_TYPE MATCHES "Debug")
     SET (QTLIBLIST QtCored QtGuid)
ENDIF (CMAKE_BUILD_TYPE MATCHES "Debug")
# the variable and library names are not the same
# IF (WIN32)
#  SET (QTLIBLIST ${QTLIBLIST} QTASSISTANTCLIENT)
# ELSE (WIN32)
#  SET (QTLIBLIST ${QTLIBLIST} QTASSISTANT)
# ENDIF (WIN32)

IF(NOT Q_WS_MAC)
   FOREACH(qtlib ${QTLIBLIST})
     IF (NOT WIN32)
       #INSTALL(FILES ${QT_${qtlib}_LIBRARY_RELEASE} DESTINATION $ 
{PV_INSTALL_LIB_DIR_CM24})
       GET_FILENAME_COMPONENT(QT_LIB_DIR_tmp ${QT_${qtlib} 
_LIBRARY_RELEASE} PATH)
       GET_FILENAME_COMPONENT(QT_LIB_NAME_tmp ${QT_${qtlib} 
_LIBRARY_RELEASE} NAME)
       FILE(GLOB QT_LIB_LIST RELATIVE ${QT_LIB_DIR_tmp} "${QT_${qtlib} 
_LIBRARY_RELEASE}*")
       INSTALL(CODE "
MESSAGE(STATUS \"Installing \${CMAKE_INSTALL_PREFIX}/$ 
{PV_INSTALL_LIB_DIR_CM24}/${QT_LIB_NAME_tmp}\")
EXECUTE_PROCESS (WORKING_DIRECTORY ${QT_LIB_DIR_tmp}
                  COMMAND tar c ${QT_LIB_LIST}
                  COMMAND tar -xC \${CMAKE_INSTALL_PREFIX}/$ 
{PV_INSTALL_LIB_DIR_CM24})
         " COMPONENT Runtime)
     ELSE (NOT WIN32)
       GET_FILENAME_COMPONENT(QT_DLL_PATH_tmp ${QT_QMAKE_EXECUTABLE}  
PATH)
       INSTALL(FILES ${QT_DLL_PATH_tmp}/${qtlib}4.dll
             DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
             COMPONENT Runtime)
     ENDIF (NOT WIN32)

   ENDFOREACH(qtlib)
ENDIF(NOT Q_WS_MAC)

# -------------------------- Find the MinGW Runtime library  
--------------------
# - This assumes that you built Qt or any other support library as a  
shared
# - library. If all your support libraries are static this this  
probably is
# - NOT needed.
IF (MINGW)
     INCLUDE ( ${MXATools_PROJECT_DIR}/Resources/MXAFindMinGW.cmake )
     IF (MINGW_FOUND)
         INSTALL(FILES ${MINGW_LIBRARIES}
                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
                 COMPONENT Runtime)
     ENDIF (MINGW_FOUND)
ENDIF (MINGW)



-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Jun 18, 2008, at 12:51 PM, Mike Arthur wrote:

> We can't static-link Qt into our application as we're relying on  
> dynamic
> loading of plugins.
>
> As a result I want to install the necessary Qt*.dll files.
>
> Is there an easy (or not so easy) way of getting these files from
> ${QT_LIBRARIES} or something similar?
>
> Thanks in advance!
> -- 
> Cheers,
> Mike Arthur
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list