[CMake] Qt4 module too restrictive about uic requirement

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Jan 10 12:34:16 EST 2011


Hello,

The FindQt4 module requires the uic executable to be present, otherwise
it declares the Qt installation as invalid and bails out.

However, Qt can be compiled without the GUI (which is interesting on
embedded systems), and in this case, uic is not installed and not
necessary. Therefore, the requirement of uic to be part of the standard
Qt installation by CMake is a bit too restrictive. It should only
require it when the QT_GUI component is used.

I have worked around the problem using the following patch, but it
isn't correct as it completely removes the check for uic.
Unfortunately, my CMake-fu is still very limited, so I don't really
know what's the proper way of checking this.

Regards,

Thomas

Remove requirement of UIC in CMake QT4 module

The CMake QT4 module requires the uic executable to be present, even
when Qt GUI is not needed. This is a problem since uic is not
installed when Qt GUI is not built.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 Modules/FindQt4.cmake |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: cmake-2.8.3/Modules/FindQt4.cmake
===================================================================
--- cmake-2.8.3.orig/Modules/FindQt4.cmake
+++ cmake-2.8.3/Modules/FindQt4.cmake
@@ -1089,20 +1089,20 @@
 
   # 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 
-      QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
+      QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
     SET( QT4_FOUND "YES" )
     INCLUDE(FindPackageMessage)
     FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})"
-      "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_UIC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]")
+      "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]")
   ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND
-        QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
+        QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
     SET( QT4_FOUND "NO")
     SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
     IF( Qt4_FIND_REQUIRED)
-      MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
+      MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, or/and rcc NOT found!")
     ENDIF( Qt4_FIND_REQUIRED)
   ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND 
-         QT_UIC_EXECUTABLE AND  QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
+         QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY)
   
   SET(QT_FOUND ${QT4_FOUND})
 

-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


More information about the CMake mailing list