[cmake-developers] Correct way to get include directories for a target (automoc regression) ?

Alexander Neundorf neundorf at kde.org
Fri Nov 9 13:07:17 EST 2012


Hi,

as you know, there is a regression in 2.8.10 with automoc:
http://public.kitware.com/Bug/view.php?id=13667
http://public.kitware.com/Bug/view.php?id=13646

I'm looking at this right now.
The problem is that when moc is invoked, an include directory is missing, -
I/usr/lib/qt/include is missing.

Now, I printed ${QT_INCLUDES} in the CMakeLists.txt:

-- qt: 
-/usr/lib/qt/include/QtXmlPatterns;/usr/lib/qt/include/QtXml;/usr/lib/qt/include/QtWebKit;/usr/lib/qt/include/QtUiTools;/usr/lib/qt/include/QtTest;/usr/lib/qt/include/QtSvg;/usr/lib/qt/include/QtSql;/usr/lib/qt/include/QtScriptTools;/usr/lib/qt/include/QtScript;/usr/lib/qt/include/QtOpenGL;/usr/lib/qt/include/QtNetwork;/usr/lib/qt/include/QtMultimedia;/usr/lib/qt/include/QtHelp;/usr/lib/qt/include/QtDesigner;/usr/lib/qt/include/QtDesigner;/usr/lib/qt/include/QtDeclarative;/usr/lib/qt/include/QtDBus;/usr/lib/qt/include/Qt3Support;/usr/lib/qt/include/QtGui;/usr/lib/qt/include/QtCore;/usr/lib/qt/include/Qt;/usr/lib/qt/mkspecs/default;/usr/lib/qt/include-

This has /usr/lib/qt/includes/ at the end.

Now I added debug output to the point where the include directories are 
queried from the target in cmQtAutomoc.cxx:


std::vector<std::string> includeDirs;
cmGeneratorTarget gtgt(target);
localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX");
std::string _moc_incs = "";
const char* sep = "";
fprintf(stderr, "---------- %s--------\n", targetNames);
for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
    incDirIt != includeDirs.end();
    ++incDirIt)
  {
  fprintf(stderr, "%s\n", incDirIt->c_str());
  _moc_incs += sep;
  sep = ";";
  _moc_incs += *incDirIt;
  }


This gives: 

---------- phononqmlplugin--------
/home/alex/src/packages/phonon/build-HEAD/declarative
/home/alex/src/packages/phonon/declarative
/home/alex/src/packages/phonon
/home/alex/src/packages/phonon/includes
/home/alex/src/packages/phonon/phonon
/home/alex/src/packages/phonon/build-HEAD/phonon
/home/alex/src/packages/phonon/build-HEAD/declarative/..
/usr/lib/qt/include/QtXmlPatterns
/usr/lib/qt/include/QtXml
/usr/lib/qt/include/QtWebKit
/usr/lib/qt/include/QtUiTools
/usr/lib/qt/include/QtTest
/usr/lib/qt/include/QtSvg
/usr/lib/qt/include/QtSql
/usr/lib/qt/include/QtScriptTools
/usr/lib/qt/include/QtScript
/usr/lib/qt/include/QtOpenGL
/usr/lib/qt/include/QtNetwork
/usr/lib/qt/include/QtMultimedia
/usr/lib/qt/include/QtHelp
/usr/lib/qt/include/QtDesigner
/usr/lib/qt/include/QtDeclarative
/usr/lib/qt/include/QtDBus
/usr/lib/qt/include/Qt3Support
/usr/lib/qt/include/QtGui
/usr/lib/qt/include/QtCore
/usr/lib/qt/include/Qt
/usr/lib/qt/mkspecs/default
---------- phonon--------


So here /usr/lib/qt/include is missing.

Am I doing something wrong or is the list of returned include dirs wrong ?

Alex



More information about the cmake-developers mailing list