[CMake] CMake is unable to find QtCore!

Andreas Pakulat apaku at gmx.de
Mon Aug 13 14:46:19 EDT 2012


Hi,

On Mon, Aug 13, 2012 at 4:16 PM, Toronto Andrew
<andrew.louis93 at gmail.com> wrote:
> Haha spot on mate.
>
> I did so. To rectify, I reinstalled VTK and CMake, fixed the PATH var and
> the QTDIR.

Relocating Qt requires either patching the qmake binary or installing
a qt.conf file to help qmake find the libs in the new position. The
absolute include/lib dirs are hardcoded into qmake when its being
built. See http://doc.qt.nokia.com/4.7/qt-conf.html for the
file-format

> FindQt4 now actually finds 4.8.2 as opposed to 4.8.0, however
> some flags like QT_USE_FILE and QT_QTGUI_LIBRARY seem to still point at
> 4.8.0 prompting some linker issues during the build.

Does that mean you didn't move Qt this time?

> http://cmake.3232098.n2.nabble.com/file/n7581165/8Mj17.png
>
> Just for reference, the CMakeLists is found  http://pastie.org/4466367 here
> if need be.

Did you start with a clean cache? The screenshot suggests you're
trying to mix debug and release Qt libraries, thats a very bad idea
anyways (QtOpenGLdd and QtGui4 are mentioned). So maybe things are
still not picked up as you think they are? The cache-file should have
more information.

And you should get rid of LINK_DIRECTORIES, thats not a good idea and
almost always the wrong fix to whatever linking problems you have.
CMake find-modules are supposed to setup the absolute path to
libraries in the variables they 'export', which can be used with
target_link_libraries directly. Same goes for the 'link_libraries'
call for MacOSX I'd say.

Andreas


More information about the CMake mailing list