Important: Please read the Qt Code of Conduct -

QtMobility include directory problems with CMake

  • I’m using CMake to make my makefiles. I’m using QtMobility in my project, but I constantly get an error that qmobilityglobal.h cannot be found. I’m including the headers directory (/usr/include/QtMobility) and I’ve looked, the file is located in that directory. I then copied the header file from /usr/include/QtMobility to /usr/include and only included /usr/include in CMake. I’ve compiled and vola, the build succeded.
    I’ve then tested again with the /usr/include/QtMobility directory, but instead of doing this in my C++ code (Option 1):
    @#include <qmobilityglobal.h>@
    I'm no doing this (Option 2):
    @#include <QtMobility/qmobilityglobal.h>@
    And this also worked 100%.

    The problem I have is that all the Qt header files include related Qt files like option 1 and not option 2 and that gives me a lot of compile errors. I also don’t want to go and change all the header files in QtMobility.

    Does anyone know why this is and if there is an easy way of fixing this with my cmake file?

  • Ok this is weird, if I put the include statment in the root CMakeLists.txt file, it works. So it rather seems like a CMake problem than a Qt problem.

    Sorry for posting here.

Log in to reply