CMake bug? (it can't find QtCore)

Hi folks. I tried to build hedgewars-0.9.7. It uses CMake build system. But CMake says it can’t find QtCore though it says “-- Looking for Q_WS_X11 - found”. I posted report to official hedgewars forum. They suggested it could be a CMake bug.
OS is OpenSUSE 11.0

dusoft@suse-note:~/builds> tar jxf ~/downloads/hedgewars-src-0.9.7.tar.bz2
dusoft@suse-note:~/builds> cd hedgewars-src-0.9.7/
dusoft@suse-note:~/builds/hedgewars-src-0.9.7> cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - 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 - not found.
CMake Error at /usr/share/cmake/Modules/FindQt4.cmake:788 (MESSAGE):
  Could NOT find QtCore.  Check
  /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeError.log for more
  details.
Call Stack (most recent call first):
  QTfrontend/CMakeLists.txt:11 (find_package)


-- Configuring incomplete, errors occurred!
dusoft@suse-note:~/builds/hedgewars-src-0.9.7> cmake --version
cmake version 2.6-patch 2
dusoft@suse-note:~/builds/hedgewars-src-0.9.7> cat CMakeFiles/CMakeError.log
Determining if the Q_WS_WIN exist failed with the following output:
Change Dir: /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o
/usr/bin/gcc    -o CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o   -c /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: ‘Q_WS_WIN’ undeclared (first use in this function)
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: (Each undeclared identifier is reported only once
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: for each function it appears in.)
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2

File /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <QtCore/qglobal.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef Q_WS_WIN
  cmakeRequireSymbol(0,&Q_WS_WIN);
#endif
  return 0;
}

Determining if the Q_WS_QWS exist failed with the following output:
Change Dir: /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o
/usr/bin/gcc    -o CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o   -c /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: ‘Q_WS_QWS’ undeclared (first use in this function)
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: (Each undeclared identifier is reported only once
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: for each function it appears in.)
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2

File /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <QtCore/qglobal.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef Q_WS_QWS
  cmakeRequireSymbol(0,&Q_WS_QWS);
#endif
  return 0;
}

Determining if the Q_WS_MAC exist failed with the following output:
Change Dir: /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o
/usr/bin/gcc    -o CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o   -c /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: ‘Q_WS_MAC’ undeclared (first use in this function)
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: (Each undeclared identifier is reported only once
/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: error: for each function it appears in.)
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory `/home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2

File /home/dusoft/builds/hedgewars-src-0.9.7/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <QtCore/qglobal.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef Q_WS_MAC
  cmakeRequireSymbol(0,&Q_WS_MAC);
#endif
  return 0;
}
dusoft@suse-note:~/builds/hedgewars-src-0.9.7> qmake --version
QMake version 2.01a
Using Qt version 4.4.0 in /usr/lib

Do you have the Qt development package installed?

Yes I do. From log we can see that CMake has found qt-x11 but didn’t set some flag indicating that QT is found. If I understand it right

The problem was in my QT packages. Recently I upgraded my Qt packages to 4.4.3 from KDE4:Extras and I got wrong symlink
/usr/lib/libQtCore.so -> /usr/lib/libQtCore.so.4.4.0
but was absent /usr/lib/libQtCore.so.4.4.0.
I downgraded to 4.4.0 from standard repo and got no /usr/lib/libQtCore.so symlink at all. So I manually added symlink
/usr/lib/libQtCore.so -> /usr/lib/libQtCore.so.4.4.0
and CMake have finally found my Qt installation.