diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-08-02 20:34:23 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-08-02 20:34:23 (GMT) |
commit | feb50198905f622ac1ef38f636c93a6f8eea5f89 (patch) | |
tree | 48f952835e65c4c1054b05b3a3baa6802afb41d3 /Modules | |
parent | 67d336ece8bb801dbf79fb2808f1b385f294f9c2 (diff) | |
download | CMake-feb50198905f622ac1ef38f636c93a6f8eea5f89.zip CMake-feb50198905f622ac1ef38f636c93a6f8eea5f89.tar.gz CMake-feb50198905f622ac1ef38f636c93a6f8eea5f89.tar.bz2 |
ENH: add changes for qt4 from Clinton Stimpson
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindQt4.cmake | 119 |
1 files changed, 97 insertions, 22 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index fa8b69a..5b8aaaf 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -10,6 +10,10 @@ # This module defines # QT_INCLUDES ,list of paths to all include directories of Qt4 # +# macro QT4_WRAP_CPP(outfiles inputfile ... ) +# macro QT4_WRAP_UI(outfiles inputfile ... ) +# macro QT4_ADD_RESOURCE(outfiles inputfile ... ) +# # QT_INCLUDE_DIR ,path to "include" of Qt4 # QT_QT_INCLUDE_DIR ,path to "include/Qt" of Qt4 # QT_QT3SUPPORT_INCLUDE_DIR ,path to "include/Qt3Support" of Qt @@ -279,7 +283,7 @@ IF(NOT QT_QTCORE_LIBRARY) ENDIF(QT_QMAKE) # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename FIND_LIBRARY( QT_QTCORE_LIBRARY - NAMES QtCore + NAMES QtCore QtCore4 PATHS ${qt_libs} $ENV{QTDIR}/lib @@ -300,7 +304,7 @@ IF(NOT QT_QTCORE_LIBRARY_DEBUG) OUTPUT_VARIABLE qt_libs ) ENDIF(QT_QMAKE) FIND_LIBRARY( QT_QTCORE_LIBRARY_DEBUG - NAMES QtCore_debug + NAMES QtCore_debug QtCored4 PATHS ${qt_libs} $ENV{QTDIR}/lib @@ -329,82 +333,82 @@ ENDIF(NOT QT_LIBRARY_DIR) # Set QT_QT3SUPPORT_LIBRARY IF(NOT QT_QT3SUPPORT_LIBRARY) - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY Qt3Support ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QT3SUPPORT_LIBRARY) IF(NOT QT_QT3SUPPORT_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG Qt3Support_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QT3SUPPORT_LIBRARY_DEBUG) # Set QT_QTASSISTANT_LIBRARY IF(NOT QT_QTASSISTANT_LIBRARY) - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY QtAssistant ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY NAMES QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTASSISTANT_LIBRARY) IF(NOT QT_QTASSISTANT_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG QtAssistant_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTASSISTANT_LIBRARY_DEBUG) # Set QT_QTDESIGNER_LIBRARY IF(NOT QT_QTDESIGNER_LIBRARY) - FIND_LIBRARY(QT_QTDESIGNER_LIBRARY QtDesigner ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTDESIGNER_LIBRARY) IF(NOT QT_QTDESIGNER_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG QtDesigner_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTDESIGNER_LIBRARY_DEBUG) # Set QT_QTGUI_LIBRARY IF(NOT QT_QTGUI_LIBRARY) - FIND_LIBRARY(QT_QTGUI_LIBRARY QtGui ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTGUI_LIBRARY NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTGUI_LIBRARY) IF(NOT QT_QTGUI_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG QtGui_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTGUI_LIBRARY_DEBUG) # Set QT_QTMOTIF_LIBRARY IF(NOT QT_QTMOTIF_LIBRARY) - FIND_LIBRARY(QT_QTMOTIF_LIBRARY QtMotif ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY NAMES QtMotif PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTMOTIF_LIBRARY) IF(NOT QT_QTMOTIF_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG QtMotif_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTMOTIF_LIBRARY_DEBUG) # Set QT_QTNETWORK_LIBRARY IF(NOT QT_QTNETWORK_LIBRARY) - FIND_LIBRARY(QT_QTNETWORK_LIBRARY QtNetwork ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTNETWORK_LIBRARY) IF(NOT QT_QTNETWORK_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG QtNetwork_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTNETWORK_LIBRARY_DEBUG) # Set QT_QTNSPLUGIN_LIBRARY IF(NOT QT_QTNSPLUGIN_LIBRARY) - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY QtNsPlugin ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTNSPLUGIN_LIBRARY) IF(NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG QtNsPlugin_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTNSPLUGIN_LIBRARY_DEBUG) # Set QT_QTOPENGL_LIBRARY IF(NOT QT_QTOPENGL_LIBRARY) - FIND_LIBRARY(QT_QTOPENGL_LIBRARY QtOpenGL ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTOPENGL_LIBRARY) IF(NOT QT_QTOPENGL_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG QtOpenGL_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTOPENGL_LIBRARY_DEBUG) # Set QT_QTSQL_LIBRARY IF(NOT QT_QTSQL_LIBRARY) - FIND_LIBRARY(QT_QTSQL_LIBRARY QtSql ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTSQL_LIBRARY NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTSQL_LIBRARY) IF(NOT QT_QTSQL_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG QtSql_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTSQL_LIBRARY_DEBUG) # Set QT_QTXML_LIBRARY IF(NOT QT_QTXML_LIBRARY) - FIND_LIBRARY(QT_QTXML_LIBRARY QtXml ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTXML_LIBRARY NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTXML_LIBRARY) IF(NOT QT_QTXML_LIBRARY_DEBUG) - FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG QtXml_debug ${QT_LIBRARY_DIR}) + FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR}) ENDIF(NOT QT_QTXML_LIBRARY_DEBUG) # Make variables changeble to the advanced user @@ -732,6 +736,77 @@ MARK_AS_ADVANCED( ###################################### # +# Macros for building Qt files +# +###################################### + + +# QT4_WRAP_CPP(outfiles inputfile ... ) +# TODO perhaps add support for -D, -U and other minor options + +MACRO(QT4_WRAP_CPP outfiles ) + + # get include dirs + GET_DIRECTORY_PROPERTY(moc_includes_tmp INCLUDE_DIRECTORIES) + SET(moc_includes) + FOREACH(it ${moc_includes_tmp}) + SET(moc_includes ${moc_includes} "-I${it}") + ENDFOREACH(it) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${moc_includes} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + +ENDMACRO(QT4_WRAP_CPP) + + +# QT4_WRAP_UI(outfiles inputfile ... ) + +MACRO(QT4_WRAP_UI outfiles ) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_UIC_EXECUTABLE} + ARGS -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + +ENDMACRO(QT4_WRAP_UI) + +# QT4_ADD_RESOURCE(outfiles inputfile ... ) +# TODO perhaps consider adding support for compression and root options to rcc + +MACRO(QT4_ADD_RESOURCES outfiles ) + + FOREACH(it ${ARGN}) + GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) + SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it}) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS -name ${outfilename} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} ) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + +ENDMACRO(QT4_ADD_RESOURCES) + + + +###################################### +# # deside if Qt got found # ###################################### |