[Cmake] Making the cmake FindXXX.cmake files more consistent

Ian Scott ian . m . scott at stud . man . ac . uk
Mon, 19 Aug 2002 15:03:06 +0100


I've put a (slightly better) copy of this file in the CMake repository in
the Modules directory under the tag "tidy_modules"

You can get the modified version by going into the directory Modules and
typing
cvs up -r tidy_modules

I suggest we play around with the tagged version of some of these files
until we are happy with them.

Ian.

> -----Original Message-----
> From: Ian Scott
> Sent: Monday, August 19, 2002 2:49 PM
> To: 'Brad King'; Amitha Perera; CMake
> Subject: RE: [Cmake] Making the cmake FindXXX.cmake files more
> consistent
>
>
> Here is my suggestion for a FindQt.cmake
>
> I think CMAke will automatically put QT_INCLUDE_DIR, QT_QT_LIBRARY,
> QT_MOC_EXECUTABLE, and QT_UIC_EXECUTABLE in the cache, but
> this is rather
> more than Brad suggests is necessary.
> I guess we could have a single QT_MOST_STUFF_IN_HERE_DIR
> variable in the
> cache, but I don't know how to work backwards from the above
> variables, or
> check that a single variable is consistent. Having a single
> variable also
> assumes that qt is always distributed in the include, lib and
> bin directores
> ofa specific place - this may not always be true.
>
> Ian.
>
> # FindQt.cmake
> # Locate Qt include paths and libraries
> # Author Ian Scott.
>
> # This module defines
> # QT_INCLUDE_DIR, where to find qt.h, etc.
> # QT_QT_LIBRARY, where to find the qt library.
> # QT_MOC_EXECUTABLE, where to find the moc tool.
> # QT_UIC_EXECUTABLE, where to find the uic tool.
> # QT_WRAP_CPP, If false, don't use QT_WRAP_CPP command.
> # QT_WRAP_UI, If false, don't use QT_WRAP_UI command.
> # QT_FOUND, If false, do try to us Qt.
>
> IF (UNIX)
>
>   FIND_PATH(QT_INCLUDE_PATH qt.h
>     ${QTDIR}/include
>     /usr/local/qt/include
>     /usr/local/include
>     /usr/include
>   )
>
>   FIND_LIBRARY(QT_QT_LIBRARY qt
>     ${QTDIR}/lib
>     /usr/local/qt/lib
>     /usr/local/lib
>     /usr/lib
>   )
>
>   FIND_FILE(QT_MOC_EXECUTABLE moc
>     ${QTDIR}/bin
>     ${path}
>   )
>
>   FIND_FILE(QT_UIC_EXECUTABLE uic
>     ${QTDIR}/bin
>     ${path}
>   )
>
> ENDIF (UNIX)
>
> IF (WIN32)
>   # Not sure where to look for Qt under windows
>   # Assume that QTDIR has been set
>
>   FIND_PATH(QT_INCLUDE_DIR qt.h
>     ${QTDIR}/include C:/Progra~1/qt/include)
>   )
>
>   FIND_LIBRARY(QT_QT_LIBRARY qt
>     ${QTDIR}/lib C:/Progra~1/qt/lib)
>   )
>
>   FIND_FILE(QT_MOC_EXECUTABLE moc.exe
>     ${QTDIR}/bin C:/Progra~1/qt/bin
>     ${path}
>   )
>
>   FIND_FILE(QT_UIC_EXECUTABLE uic.exe
>     ${QTDIR}/bin C:/Progra~1/qt/bin
>     ${path}
>   )
>
> ENDIF (WIN32)
>
>
> IF (QT_MOC_EXECUTABLE)
>   SET ( QT_WRAP_CPP "YES")
> ENDIF (QT_MOC_EXE)
>
> IF (QT_UIC_EXECUTABLE)
>   SET ( QT_WRAP_UI "YES")
> ENDIF (QT_UIC_EXECUTABLE)
>
>
> IF(QT_INCLUDE_DIR)
>   IF(QT_QT_LIBRARY)
>     IF (WIN32)
>       #Ensure that qt.lib is last
>       SET(QT_LIBRARIES imm32.lib ws2_32.lib)
>     ENDIF (WIN32)
>     SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} )
>     SET( QT_FOUND "YES" )
>     SET ADD_DEFINITIONS( -DHAS_QT )
>   ENDIF(QT_QT_LIBRARY)
> ENDIF(QT_INCLUDE_PATH)
>
>
>
> _______________________________________________
> Cmake mailing list
> Cmake at public . kitware . com
> http://public . kitware . com/mailman/listinfo/cmake
>