Changeset 14622


Ignore:
Timestamp:
Dec 16, 2015, 6:46:06 PM (7 years ago)
Author:
mikedld
Message:

Bump CMake to 2.8.12, rework Qt use a little

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r14598 r14622  
    1 cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
     1cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
    22project(transmission)
    33
     
    222222    endif()
    223223
     224    set(QT_TARGETS)
    224225    if(USE_QT5)
    225         set(TR_QT5_MODULES Core Gui Widgets Network DBus LinguistTools)
    226         set(QT_FOUND ON)
    227         foreach(M ${TR_QT5_MODULES})
    228             find_package(Qt5${M} ${QT_IS_REQUIRED})
    229             if(NOT Qt5${M}_FOUND)
    230                 set(QT_FOUND OFF)
     226        set(QT5_REQUIRED_MODULES Core Gui Widgets Network DBus LinguistTools)
     227        foreach(M ${QT5_REQUIRED_MODULES})
     228            find_package(Qt5${M} QUIET)
     229            if(Qt5${M}_FOUND)
     230                if(NOT M STREQUAL "LinguistTools")
     231                    list(APPEND QT_TARGETS Qt5::${M})
     232                endif()
     233            else()
     234                set(QT_TARGETS)
    231235                break()
    232236            endif()
    233237        endforeach()
    234238    else()
    235         find_package(Qt4 4.6.2 ${QT_IS_REQUIRED} COMPONENTS QtCore QtGui QtNetwork QtDBus)
     239        set(QT4_REQUIRED_MODULES QtCore QtGui QtNetwork QtDBus)
     240        find_package(Qt4 4.6.2 QUIET COMPONENTS ${QT4_REQUIRED_MODULES})
     241        foreach(M ${QT4_REQUIRED_MODULES})
     242            string(TOUPPER "${M}" M_UPPER)
     243            if(QT_${M_UPPER}_FOUND)
     244                list(APPEND QT_TARGETS Qt4::${M})
     245            else()
     246                set(QT_TARGETS)
     247                break()
     248            endif()
     249        endforeach()
     250    endif()
     251
     252    set(QT_FOUND ON)
     253    if(NOT QT_TARGETS)
     254        if(QT_IS_REQUIRED)
     255            message(FATAL_ERROR "Unable to find Qt libraries.")
     256        endif()
     257        set(QT_FOUND OFF)
    236258    endif()
    237259
  • trunk/qt/CMakeLists.txt

    r14621 r14622  
    207207target_link_libraries(${TR_NAME}-qt
    208208    ${TR_NAME}
    209     ${QT_LIBRARIES}
     209    ${QT_TARGETS}
    210210    ${CURL_LIBRARIES}
    211211    ${EVENT2_LIBRARIES}
     
    216216endif()
    217217
    218 if(USE_QT5)
    219     qt5_use_modules(${TR_NAME}-qt ${TR_QT5_MODULES})
    220 endif()
    221 
    222218set_target_properties(${TR_NAME}-qt PROPERTIES AUTOMOC TRUE)
    223219
Note: See TracChangeset for help on using the changeset viewer.