FindQt4DLLs.cmake 1.37 KB
Newer Older
schultezub's avatar
schultezub committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Try to find Win32 Qt DLLs to be copied to the bin directory. Once done this will define:
# QT_DLLS_FOUND
# QT_DEBUG_DLLS
# QT_RELEASE_DLLS
#
# Note: FIND_PACKAGE(Qt4 ...) has to be called before in order for ${QT_LIBRARY_DIR} 
# and ${QT_BINARY_DIR} to be defined!

# DLLs are either located in Qt library or binary directory
IF(EXISTS ${QT_LIBRARY_DIR}/QtCored4.dll)
    SET(DLL_DIR ${QT_LIBRARY_DIR})
ELSEIF(EXISTS ${QT_BINARY_DIR}/QtCored4.dll)
    SET(DLL_DIR ${QT_BINARY_DIR})
ELSEIF(EXISTS ${QT_LIBRARY_DIR}/QtCore4.dll)
    SET(DLL_DIR ${QT_LIBRARY_DIR})
ELSEIF(EXISTS ${QT_BINARY_DIR}/QtCore4.dll)
    SET(DLL_DIR ${QT_BINARY_DIR})
ENDIF()

IF(DLL_DIR)
    SET(QT_DLLS_FOUND TRUE)
    
schultezub's avatar
schultezub committed
23
    FOREACH(component ${Qt4DLLs_FIND_COMPONENTS})
schultezub's avatar
schultezub committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
        IF(EXISTS ${DLL_DIR}/${component}d4.dll)
            LIST(APPEND QT_DEBUG_DLLS ${DLL_DIR}/${component}d4.dll)
        ELSE()
            MESSAGE("Failed to find Qt Debug DLL: ${component}d4.dll")
            SET(QT_DLLS_FOUND FALSE)
        ENDIF()
        
        IF(EXISTS ${DLL_DIR}/${component}4.dll)
            LIST(APPEND QT_RELEASE_DLLS ${DLL_DIR}/${component}4.dll)
        ELSE()
            MESSAGE(WARNING "Failed to find Qt Release DLL: ${component}4.dll")
            SET(QT_DLLS_FOUND FALSE)
        ENDIF()
    ENDFOREACH()
ELSE()
    SET(QT_DLLS_FOUND FALSE)
ENDIF()

schultezub's avatar
schultezub committed
42
43
UNSET(Qt4DLLsCAMPVIS_DIR)
MARK_AS_ADVANCED(Qt4DLLsCAMPVIS_DIR)