MantisBT - CMake
View Issue Details
0010632CMakeModulespublic2010-04-28 05:032010-04-29 16:52
petr vanek 
Clinton Stimpson 
normalmajoralways
closedwon't fix 
CMake-2-8 
 
0010632: FindQt4.cmake - QT_INCLUDE_DIR is wrongly set on mac os x (bundles)
The QT_INCLUDE_DIR variable is set to:
/opt/local/libexec/qt4-mac/include;/opt/local/libexec/qt4-mac/lib/QtCore.framework

But it should be only the:
/opt/local/libexec/qt4-mac/include


Related output of the sample CMakeConfig.txt (attached):

-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found.
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt-Version 4.6.2 (using /opt/local/bin/qmake)
-- Found OpenSSL: /usr/lib/libssl.dylib;/usr/lib/libcrypto.dylib
-- QT_INCLUDE_DIR: /opt/local/libexec/qt4-mac/include;/opt/local/libexec/qt4-mac/lib/QtCore.framework


it looks like it's all done in this code (FindQt4.cmake):

  # If Qt is installed as a framework, we need to add QT_QTCORE_LIBRARY here (which
  # is the framework directory in that case), since this will make the cmake include_directories()
  # command recognize that we need the framework flag with the respective directory (-F)
  IF(QT_USE_FRAMEWORKS)
    SET(QT_INCLUDES ${QT_INCLUDES} ${QT_QTCORE_LIBRARY} )
    SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR} ${QT_QTCORE_LIBRARY} )
  ENDIF(QT_USE_FRAMEWORKS)

I don't understand mac's frameworks too much but I don't see any reason why there should be QT_QTCORE_LIBRARY listed in includes related variable.

I'm using Qt4 (qt4-mac) and cmake from macports.

rimmer:test pvanek$ qmake -query
QT_INSTALL_PREFIX:/opt/local/libexec/qt4-mac
QT_INSTALL_DATA:/opt/local/libexec/qt4-mac
QT_INSTALL_DOCS:/opt/local/share/doc/qt4-mac
QT_INSTALL_HEADERS:/opt/local/libexec/qt4-mac/include
QT_INSTALL_LIBS:/opt/local/libexec/qt4-mac/lib
QT_INSTALL_BINS:/opt/local/libexec/qt4-mac/bin
QT_INSTALL_PLUGINS:/opt/local/libexec/qt4-mac/plugins
QT_INSTALL_TRANSLATIONS:/opt/local/libexec/qt4-mac/translations
QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
QT_INSTALL_EXAMPLES:/opt/local/share/qt4-mac/examples
QT_INSTALL_DEMOS:/opt/local/share/qt4-mac/demos
QMAKE_MKSPECS:/opt/local/libexec/qt4-mac/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.6.2
No tags attached.
txt CMakeLists.txt (141) 2010-04-28 05:03
https://public.kitware.com/Bug/file/3071/CMakeLists.txt
Issue History
2010-04-28 05:03petr vanekNew Issue
2010-04-28 05:03petr vanekFile Added: CMakeLists.txt
2010-04-29 11:54Clinton StimpsonNote Added: 0020476
2010-04-29 11:54Clinton StimpsonStatusnew => assigned
2010-04-29 11:54Clinton StimpsonAssigned To => Clinton Stimpson
2010-04-29 14:24petr vanekNote Added: 0020479
2010-04-29 14:28petr vanekNote Edited: 0020479
2010-04-29 15:44Clinton StimpsonNote Added: 0020481
2010-04-29 16:52Clinton StimpsonStatusassigned => closed
2010-04-29 16:52Clinton StimpsonResolutionopen => won't fix

Notes
(0020476)
Clinton Stimpson   
2010-04-29 11:54   
That was done on purpose. How is it a problem for you?
(0020479)
petr vanek   
2010-04-29 14:24   
(edited on: 2010-04-29 14:28)
I'm working on software (kdebindings and its derivates) which uses this variable as path to the include files to parse with its internal tool.

Of course it can be workarounded but I thought that this variable should point to the include dir only. Frameworks should go with libs related variables, shouldn't they?

But as I said - I'm newbie in the mac world.

cmake cfg file:
http://websvn.kde.org/trunk/KDE/kdebindings/smoke/qtcore/CMakeLists.txt?revision=1084718&view=markup [^]

to process this template:
http://websvn.kde.org/trunk/KDE/kdebindings/smoke/qtcore/config.xml.cmake?view=markup [^]

the same is for all modules of Qt4 and more libraries (qscintilla etc.)

(0020481)
Clinton Stimpson   
2010-04-29 15:44   
On Mac, header files for frameworks go inside the framework. And then there is /opt/local/libexec/qt4-mac/include for other header files.
So really, there are two include paths. One passed to the compiler as
-I/opt/local/libexec/qt4-mac/include, and the other passed to the compiler as
-F/opt/local/libexec/qt4-mac/lib (which is used for finding framework headers).
CMake will create the -F one from /opt/local/libexec/qt4-mac/lib/QtCore.framework