[cmake-developers] [CMake] CMake 2.8.3-rc1 ready for testing!

Alexander Neundorf neundorf at kde.org
Thu Sep 23 15:40:02 EDT 2010


On Thursday 23 September 2010, Alexander Neundorf wrote:
> On Wednesday 15 September 2010, David Cole wrote:
> > I am happy to announce that CMake 2.8.3 has entered the release
> > candidate stage! You can find the source and binaries here:
> > http://www.cmake.org/files/v2.8/?C=M;O=D
> >
> > Following is the list of changes in this release. (If you notice
> > something missing please let me know and I will add it to the official
> > release when 2.8.3 is finalized.)
> >
> > Please try this version of CMake on your projects and report any
> > issues to the list or the bug tracker.
>
> Found two issues today (compared to 2.8.1, didn't check 2.8.2):
>
> * cmake-gui doesn't remember whether "Advanced" checkbox was checked or not
>
> * FindQt4.cmake: in all previous versions it was possible to force a
> special Qt version by presetting QT_QMAKE_EXECUTABLE. This is also what I
> recommended many times on mailing lists to different people. It seems this
> is not possible anymore.


I just checked, with cmake 2.8.2 also the output from QT_QMAKE_EXECUTABLE was 
preferred, even over CMAKE_PREFIX_PATH.

I checked what changed.
In cmake <= 2.8.2 there is this code:

SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
                 QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
                 QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus
                 QtScriptTools QtDeclarative)

...

# find the libraries
FOREACH(QT_MODULE ${QT_MODULES})
  STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  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
               NAMES ${QT_MODULE}${QT_LIBINFIX}_debug
                     ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
               PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
      )
ENDFOREACH(QT_MODULE)

I.e. find_library() was called with NO_DEFAULT_PATH, so *only* the output from 
qmake was used.

Now in cmake 2.8.3 there is:

FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE
             NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
             HINTS ${QT_LIBRARY_DIR_TMP}
    )
FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG
             NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d
                   QtCore${QT_LIBINFIX}d4
             HINTS ${QT_LIBRARY_DIR_TMP}
    )
...
IF(QT_QTCORE_LIBRARY_RELEASE)
  GET_FILENAME_COMPONENT(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}"
                         PATH)
  SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir"
      FORCE)
  SET(QT_QTCORE_FOUND 1)
ELSEIF(QT_QTCORE_LIBRARY_DEBUG)
...

FOREACH(QT_MODULE ${QT_MODULES})
  STRING(TOUPPER ${QT_MODULE} _upper_qt_module)
  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
               NAMES ${QT_MODULE}${QT_LIBINFIX}_debug
                     ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
               PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH
      )
ENDFOREACH(QT_MODULE)


I.e. now find_library() is called with HINTS, but not with NO_DEFAULT_PATH. In 
my case this has the effect that the Qt which is in CMAKE_PREFIX_PATH is 
preferred over the output from qmake, so I end up with LibQtCore.so from Qt 
4.5 while my qmake is Qt 4.7:
b283$ grep QMAKE CMakeCache.txt
QT_QMAKE_EXECUTABLE:FILEPATH=/opt/qt4.7/bin/qmake
QT_QMAKE_EXECUTABLE_LAST:INTERNAL=/opt/qt4.7/bin/qmake
b283$ grep QTCORE_LIBRARY: CMakeCache.txt
QT_QTCORE_LIBRARY:STRING=/opt/qt-4.5/qt/lib/libQtCore.so
b283$ grep QTXML_LIBRARY: CMakeCache.txt
QT_QTXML_LIBRARY:STRING=/opt/qt-4.5/qt/lib/libQtXml.so


This was committed here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b55da4c688bbf55b442908464e0f7e2e41c937a3
which has as commit message "Add cross-compiling support to FindQt4.cmake"

What speaks against adding the NO_DEFAULT_PATH again ?

Alex



More information about the cmake-developers mailing list