From c12eb12011fa975fc166a327da166826d6c9d2f3 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Fri, 7 Mar 2014 09:46:24 +0100 Subject: [PATCH 3/4] sync FindQt4 from kdelibs/master to unbreak build with cmake/next --- cmake/FindQt4.cmake | 301 ++++++++++++++++++++++++---------------------------- 1 file changed, 139 insertions(+), 162 deletions(-) diff --git a/cmake/FindQt4.cmake b/cmake/FindQt4.cmake index 75aa34c..e439a72 100644 --- a/cmake/FindQt4.cmake +++ b/cmake/FindQt4.cmake @@ -2,8 +2,8 @@ # This module can be used to find Qt4. # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. -# This module defines a number of key variables and macros. -# The variable QT_USE_FILE is set which is the path to a CMake file that can be included +# This module defines a number of key variables and macros. +# The variable QT_USE_FILE is set which is the path to a CMake file that can be included # to compile Qt 4 applications and libraries. It sets up the compilation # environment for include directories, preprocessor defines and populates a # QT_LIBRARIES variable. @@ -15,10 +15,10 @@ # target_link_libraries(myexe ${QT_LIBRARIES}) # # The minimum required version can be specified using the standard find_package()-syntax -# (see example above). +# (see example above). # For compatibility with older versions of FindQt4.cmake it is also possible to -# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the -# find_package(Qt4) command. +# set the variable QT_MIN_VERSION to the minimum required version of Qt4 before the +# find_package(Qt4) command. # If both are used, the version used in the find_package() command overrides the # one from QT_MIN_VERSION. # @@ -53,26 +53,26 @@ # QT_USE_QTSCRIPTTOOLS # QT_USE_QTDECLARATIVE # -# QT_USE_IMPORTED_TARGETS +# QT_USE_IMPORTED_TARGETS # If this variable is set to TRUE, FindQt4.cmake will create imported -# library targets for the various Qt libraries and set the +# library targets for the various Qt libraries and set the # library variables like QT_QTCORE_LIBRARY to point at these imported -# targets instead of the library file on disk. This provides much better -# handling of the release and debug versions of the Qt libraries and is +# targets instead of the library file on disk. This provides much better +# handling of the release and debug versions of the Qt libraries and is # also always backwards compatible, except for the case that dependencies -# of libraries are exported, these will then also list the names of the +# of libraries are exported, these will then also list the names of the # imported targets as dependency and not the file location on disk. This # is much more flexible, but requires that FindQt4.cmake is executed before # such an exported dependency file is processed. # # There are also some files that need processing by some Qt tools such as moc # and uic. Listed below are macros that may be used to process those files. -# +# # macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...) # create moc code from a list of files containing Qt class with -# the Q_OBJECT declaration. Per-direcotry preprocessor definitions +# the Q_OBJECT declaration. Per-direcotry preprocessor definitions # are also added. Options may be given to moc, such as those found -# when executing "moc -help". +# when executing "moc -help". # # macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...) # create code from a list of Qt designer ui files. @@ -92,21 +92,21 @@ # macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... ) # This macro is still experimental. # It can be used to have moc automatically handled. -# So if you have the files foo.h and foo.cpp, and in foo.h a +# So if you have the files foo.h and foo.cpp, and in foo.h a # a class uses the Q_OBJECT macro, moc has to run on it. If you don't # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert # #include "foo.moc" # in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the # scan all listed files at cmake-time for such included moc files and if it finds -# them cause a rule to be generated to run moc at build time on the +# them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. # If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. # # macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename) -# create a the interface header and implementation files with the -# given basename from the given interface xml file and add it to +# create a the interface header and implementation files with the +# given basename from the given interface xml file and add it to # the list of sources. -# To disable generating a namespace header, set the source file property +# To disable generating a namespace header, set the source file property # NO_NAMESPACE to TRUE on the interface file. # To include a header in the interface header, set the source file property # INCLUDE to the name of the header. @@ -114,10 +114,10 @@ # to the name of the class. # # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) -# create the interface header and implementation files +# create the interface header and implementation files # for all listed interface xml files # the name will be automatically determined from the name of the xml file -# To disable generating namespace headers, set the source file property +# To disable generating namespace headers, set the source file property # NO_NAMESPACE to TRUE for these inputfiles. # To include a header in the interface header, set the source file property # INCLUDE to the name of the header. @@ -135,19 +135,19 @@ # # macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...) # generate the xml interface file from the given header. -# If the optional argument interfacename is omitted, the name of the +# If the optional argument interfacename is omitted, the name of the # interface file is constructed from the basename of the header with # the suffix .xml appended. # Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" # -# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... +# macro QT4_CREATE_TRANSLATION( qm_files directories ... sources ... # ts_files ... OPTIONS ...) # out: qm_files # in: directories sources ts_files # options: flags to pass to lupdate, such as -extensions to specify # extensions for a directory scan. # generates commands to create .ts (vie lupdate) and .qm -# (via lrelease) - files from directories and/or sources. The ts files are +# (via lrelease) - files from directories and/or sources. The ts files are # created and/or updated in the source tree (unless given with full paths). # The qm files are generated in the build tree. # Updating the translations can be done by adding the qm_files @@ -210,42 +210,42 @@ # The QT_USE_FILE will also define QT_DEBUG and QT_NO_DEBUG # to fit your current build type. Those are not contained # in QT_DEFINITIONS. -# -# QT_INCLUDES List of paths to all include directories of +# +# QT_INCLUDES List of paths to all include directories of # Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are # always in this variable even if NOTFOUND, # all other INCLUDE_DIRS are # only added if they are found. # You do not need to use this if you include QT_USE_FILE. -# +# # # Include directories for the Qt modules are listed here. # You do not need to use these variables if you include QT_USE_FILE. # # QT_INCLUDE_DIR Path to "include" of Qt4 -# QT_QT_INCLUDE_DIR Path to "include/Qt" -# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" -# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" +# QT_QT_INCLUDE_DIR Path to "include/Qt" +# QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" +# QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) -# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" -# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" -# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" +# QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" +# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" +# QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" -# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" +# QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" # QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp" -# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" -# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" -# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" -# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" -# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" +# QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" +# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" +# QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" +# QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" +# QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" # QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript" -# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" +# QT_QTSQL_INCLUDE_DIR Path to "include/QtSql" # QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg" # QT_QTTEST_INCLUDE_DIR Path to "include/QtTest" # QT_QTWEBKIT_INCLUDE_DIR Path to "include/QtWebKit" -# QT_QTXML_INCLUDE_DIR Path to "include/QtXml" +# QT_QTXML_INCLUDE_DIR Path to "include/QtXml" # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" # QT_PHONON_INCLUDE_DIR Path to "include/phonon" # QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools" @@ -316,7 +316,7 @@ # The qtmain library for Windows QT_QTMAIN_LIBRARY # # The Phonon library: QT_PHONON_LIBRARY -# +# # The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY # # also defined, but NOT for general use are @@ -331,17 +331,17 @@ # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool. # QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool. # QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool. +# # -# -# These are around for backwards compatibility +# These are around for backwards compatibility # they will be set # QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found # QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found -# +# # These variables do _NOT_ have any effect anymore (compared to FindQt.cmake) # QT_MT_REQUIRED Qt4 is now always multithreaded -# -# These variables are set to "" Because Qt structure changed +# +# These variables are set to "" Because Qt structure changed # (They make no sense in Qt4) # QT_QT_LIBRARY Qt-Library is now split @@ -354,12 +354,12 @@ IF( Qt4_FIND_COMPONENTS ) STRING( TOUPPER ${component} _COMPONENT ) SET( QT_USE_${_COMPONENT} 1 ) ENDFOREACH( component ) - + # To make sure we don't use QtCore or QtGui when not in COMPONENTS IF(NOT QT_USE_QTCORE) SET( QT_DONT_USE_QTCORE 1 ) ENDIF(NOT QT_USE_QTCORE) - + IF(NOT QT_USE_QTGUI) SET( QT_DONT_USE_QTGUI 1 ) ENDIF(NOT QT_USE_QTGUI) @@ -395,7 +395,7 @@ ENDIF (QT4_QMAKE_FOUND AND Qt4::QtCore) # check that QT_NO_DEBUG is defined for release configurations MACRO(QT_CHECK_FLAG_EXISTS FLAG VAR DOC) IF(NOT ${VAR} MATCHES "${FLAG}") - SET(${VAR} "${${VAR}} ${FLAG}" + SET(${VAR} "${${VAR}} ${FLAG}" CACHE STRING "Flags used by the compiler during ${DOC} builds." FORCE) ENDIF(NOT ${VAR} MATCHES "${FLAG}") ENDMACRO(QT_CHECK_FLAG_EXISTS FLAG VAR) @@ -424,13 +424,13 @@ MACRO(QT_QUERY_QMAKE outvar invar) # information. Use the same variable for both stdout and stderr # to make sure we get the output on all platforms. EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} - WORKING_DIRECTORY + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake OUTPUT_VARIABLE _qmake_query_output RESULT_VARIABLE _qmake_result ERROR_VARIABLE _qmake_query_output ) - FILE(REMOVE_RECURSE + FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") IF(_qmake_result) @@ -463,7 +463,7 @@ IF (QT_QMAKE_EXECUTABLE) SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE) SET(QT4_QMAKE_FOUND FALSE) - + _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path @@ -550,7 +550,7 @@ ENDIF (QT_QMAKE_EXECUTABLE) IF (QT4_QMAKE_FOUND) if (WIN32) - # get qt install dir + # get qt install dir get_filename_component(_DIR ${QT_QMAKE_EXECUTABLE} PATH ) get_filename_component(QT_INSTALL_DIR ${_DIR} PATH ) endif (WIN32) @@ -566,7 +566,7 @@ IF (QT4_QMAKE_FOUND) MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.") ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}") ENDIF(NOT QT_LIBRARY_DIR OR QT_QMAKE_CHANGED) - + IF (APPLE) IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS ON @@ -575,16 +575,27 @@ IF (QT4_QMAKE_FOUND) SET(QT_USE_FRAMEWORKS OFF CACHE BOOL "Set to ON if Qt build uses frameworks." FORCE) ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) - + MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) ENDIF (APPLE) - + # ask qmake for the binary dir IF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_BINS qt_bins) SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE) ENDIF (QT_LIBRARY_DIR AND NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED) + IF (APPLE) + SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) + IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK FIRST) + ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK LAST) + ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) + ENDIF (APPLE) + # ask qmake for the include dir IF (QT_LIBRARY_DIR AND NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED) _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) @@ -632,7 +643,7 @@ IF (QT4_QMAKE_FOUND) foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH}) set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports") endforeach(qt_cross_path) - FIND_PATH(QT_IMPORTS_DIR NAMES Qt QtWebKit + FIND_PATH(QT_IMPORTS_DIR NAMES Qt HINTS ${qt_cross_paths} ${qt_imports_dir} DOC "The location of the Qt imports" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH @@ -691,11 +702,11 @@ IF (QT4_QMAKE_FOUND) # ######################################## - SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools + SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools QtHelp QtWebKit QtXmlPatterns QtNetwork QtMultimedia QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools QtDeclarative) - + IF(Q_WS_X11) SET(QT_MODULES ${QT_MODULES} QtMotif) ENDIF(Q_WS_X11) @@ -763,7 +774,7 @@ IF (QT4_QMAKE_FOUND) ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers NO_DEFAULT_PATH ) - + # Set QT_QTASSISTANT_INCLUDE_DIR FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant PATHS @@ -771,7 +782,7 @@ IF (QT4_QMAKE_FOUND) ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers NO_DEFAULT_PATH ) - + # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR FIND_PATH(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient PATHS @@ -801,7 +812,7 @@ IF (QT4_QMAKE_FOUND) # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR} IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR) IF (QT_USE_FRAMEWORKS) - SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR}) + SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} ) ELSE (QT_USE_FRAMEWORKS) STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR}) SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "") @@ -847,11 +858,11 @@ IF (QT4_QMAKE_FOUND) # find the libraries FOREACH(QT_MODULE ${QT_MODULES}) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) - FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE + FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) - FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG + FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) @@ -863,7 +874,7 @@ IF (QT4_QMAKE_FOUND) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) - + # try dropping a hint if trying to use Visual Studio with Qt built by mingw IF(QT_LIBRARY_DIR AND MSVC) IF(EXISTS ${QT_LIBRARY_DIR}/libqtmain.a) @@ -887,11 +898,11 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) ENDIF(WIN32) - + # Set QT_QTASSISTANTCLIENT_LIBRARY FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - + # Set QT_QTASSISTANT_LIBRARY FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) @@ -910,7 +921,7 @@ IF (QT4_QMAKE_FOUND) # ############################################ - # On OSX when Qt is found as framework, never use the imported targets for now, since + # On OSX when Qt is found as framework, never use the imported targets for now, since # in this case the handling of the framework directory currently does not work correctly. IF(QT_USE_FRAMEWORKS) SET(QT_USE_IMPORTED_TARGETS FALSE) @@ -931,22 +942,30 @@ IF (QT4_QMAKE_FOUND) IF (QT_${basename}_LIBRARY_RELEASE) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + if (QT_USE_FRAMEWORKS) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" ) + else() + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + endif() ENDIF (QT_${basename}_LIBRARY_RELEASE) IF (QT_${basename}_LIBRARY_DEBUG) SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + if(QT_USE_FRAMEWORKS) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" ) + else() + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + endif() ENDIF (QT_${basename}_LIBRARY_DEBUG) ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these # imported targets. This works better in general, and is also in almost all cases fully - # backward compatible. The only issue is when a project A which had this enabled then exports its + # backward compatible. The only issue is when a project A which had this enabled then exports its # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project # A will depend on the imported Qt targets, and the names of these imported targets will be stored # in the dependency files on disk. This means when a project B then uses project A, these imported - # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a + # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a # library file on disk, and not as a target, and linking will fail: IF(QT_USE_IMPORTED_TARGETS) SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) @@ -1002,7 +1021,7 @@ IF (QT4_QMAKE_FOUND) ENDMACRO (_QT4_ADJUST_LIB_VARS) - # Set QT_xyz_LIBRARY variable and add + # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES _QT4_ADJUST_LIB_VARS(QtCore) _QT4_ADJUST_LIB_VARS(QtGui) @@ -1052,7 +1071,7 @@ IF (QT4_QMAKE_FOUND) ####################################### # - # Check the executables of Qt + # Check the executables of Qt # ( moc, uic, rcc ) # ####################################### @@ -1071,86 +1090,44 @@ IF (QT4_QMAKE_FOUND) SET(QT_DESIGNER_EXECUTABLE NOTFOUND) SET(QT_LINGUIST_EXECUTABLE NOTFOUND) ENDIF(QT_QMAKE_CHANGED) + + macro(_find_qt4_program VAR NAME) + find_program(${VAR} + NAMES ${ARGN} + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) + if (${VAR} AND NOT TARGET ${NAME}) + add_executable(${NAME} IMPORTED) + set_property(TARGET ${NAME} PROPERTY IMPORTED_LOCATION ${${VAR}}) + endif() + endmacro() + + _find_qt4_program(QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc moc4) + _find_qt4_program(QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic uic4) + _find_qt4_program(QT_UIC3_EXECUTABLE Qt4::uic3 uic3) + _find_qt4_program(QT_RCC_EXECUTABLE Qt4::rcc rcc) + if(NOT WINCE) + _find_qt4_program(QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml) + _find_qt4_program(QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp) + else() + FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE + NAMES qdbuscpp2xml + PATHS ${HOST_BINDIR} + NO_DEFAULT_PATH + ) - FIND_PROGRAM(QT_MOC_EXECUTABLE - NAMES moc-qt4 moc - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_UIC_EXECUTABLE - NAMES uic-qt4 uic - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_UIC3_EXECUTABLE - NAMES uic3 - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_RCC_EXECUTABLE - NAMES rcc - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - -if(NOT WINCE) - FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE - NAMES qdbuscpp2xml - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE - NAMES qdbusxml2cpp - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) -else(NOT WINCE) - FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE - NAMES qdbuscpp2xml - PATHS ${HOST_BINDIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE - NAMES qdbusxml2cpp - PATHS ${HOST_BINDIR} - NO_DEFAULT_PATH - ) -endif(NOT WINCE) - - FIND_PROGRAM(QT_LUPDATE_EXECUTABLE - NAMES lupdate-qt4 lupdate - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_LRELEASE_EXECUTABLE - NAMES lrelease-qt4 lrelease - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE - NAMES qcollectiongenerator-qt4 qcollectiongenerator - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_DESIGNER_EXECUTABLE - NAMES designer-qt4 designer - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) - - FIND_PROGRAM(QT_LINGUIST_EXECUTABLE - NAMES linguist-qt4 linguist - PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH - ) + FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE + NAMES qdbusxml2cpp + PATHS ${HOST_BINDIR} + NO_DEFAULT_PATH + ) + endif() + _find_qt4_program(QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate lupdate4) + _find_qt4_program(QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease lrelease4) + _find_qt4_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator) + _find_qt4_program(QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer designer4) + _find_qt4_program(QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist linguist4) IF (QT_MOC_EXECUTABLE) SET(QT_WRAP_CPP "YES") @@ -1187,7 +1164,7 @@ endif(NOT WINCE) ###################################### # if the includes,libraries,moc,uic and rcc are found then we have it - IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND + IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) SET( QT4_FOUND "YES" ) IF( NOT Qt4_FIND_QUIETLY) @@ -1215,15 +1192,15 @@ endif(NOT WINCE) ENDIF( NOT QT_RCC_EXECUTABLE ) MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") ENDIF( Qt4_FIND_REQUIRED) - ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND + ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) - + SET(QT_FOUND ${QT4_FOUND}) ############################################### # - # configuration/system dependent settings + # configuration/system dependent settings # ############################################### @@ -1232,7 +1209,7 @@ endif(NOT WINCE) ####################################### # - # compatibility settings + # compatibility settings # ####################################### # Backwards compatibility for CMake1.4 and 1.2 @@ -1242,11 +1219,11 @@ endif(NOT WINCE) SET( QT_QT_LIBRARY "") ELSE(QT4_QMAKE_FOUND) - + SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) - + # The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x - # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and + # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and # QT4_INSTALLED_VERSION_TOO_NEW IF(Qt4_FIND_REQUIRED) IF(QT4_INSTALLED_VERSION_TOO_OLD) @@ -1267,6 +1244,6 @@ ELSE(QT4_QMAKE_FOUND) MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) ENDIF(Qt4_FIND_REQUIRED) - + ENDIF (QT4_QMAKE_FOUND) -- 1.8.5.3