error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
Hello. In connection with a project I am working on, I found some related Qt-based code at https://code.google.com/p/cornucopia-lib/
So I cloned the hg repo, and did:
Code:
mkdir build
cd build
cmake ..
but I got the following errors:
Code:
CMake Error: The following variables are used in this project, but
they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
QT_QTSCRIPT_INCLUDE_DIR (ADVANCED)
used as include directory in directory
/home/samjnaa/sr/_repos/hg/cornucopia-lib/DemoUI
QT_QTSVG_INCLUDE_DIR (ADVANCED)
used as include directory in directory
/home/samjnaa/sr/_repos/hg/cornucopia-lib/DemoUI
used as include directory in directory
/home/samjnaa/sr/_repos/hg/cornucopia-lib/Tools
-- Configuring incomplete, errors occurred!
I wrote to the author about this but he was not sure what the problem was. So I hope someone here can indicate to me how I can fix these errors.
I am running Kubuntu Raring 64-bit with Qt 4.8.4 and CMake 2.8.10.
Thank you!
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
The CMake Qt find module uses the Qt4 qmake: is it in the PATH?
You could try this at the top of DemoUI/ CMakeLists.txt:
Code:
# CmakeLists.txt in DemoUI
FIND_PACKAGE(Qt4 COMPONENTS QtSvg QtScript REQUIRED)
SET(QT_USE_QTSVG TRUE)
SET(QT_USE_QTSCRIPT TRUE)
INCLUDE(${QT_USE_FILE})
...
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
Quote:
Originally Posted by
ChrisW67
The CMake Qt find module uses the Qt4 qmake: is it in the PATH?
Yes it is.
Quote:
You could try this at the top of DemoUI/ CMakeLists.txt:
Code:
FIND_PACKAGE(Qt4 COMPONENTS QtSvg QtScript REQUIRED)
Thank you very much! This worked to remove this particular error, but now I am getting the following error:
Code:
Scanning dependencies of target DemoUI
[ 58%] Building CXX object DemoUI/CMakeFiles/DemoUI.dir/GroupSelWidget.cpp.o
In file included from /home/samjnaa/sr/_repos/hg/cornucopia-lib/DemoUI/GroupSelWidget.cpp:21:0:
/home
/samjnaa
/sr
/_repos
/hg
/cornucopia
-lib
/DemoUI
/GroupSelWidget.
h:26:19: fatal error
: QWidget: No such
file or directory
#include <QWidget>
^
compilation terminated.
make[2]: *** [DemoUI/CMakeFiles/DemoUI.dir/GroupSelWidget.cpp.o] Error 1
make[1]: *** [DemoUI/CMakeFiles/DemoUI.dir/all] Error 2
make: *** [all] Error 2
But I have the Qt headers installed (indeed I'm sure it would have complained earlier if I had not):
Code:
...
libqt4-dev
: /usr
/include
/qt4
/QtGui
/QWidget ...
I am guessing that some CMake command is pointing to the wrong include directory or something. (Or perhaps the code needs to use "QtGui/" as in #include <QtGui/QWidget> but I'd prefer to hack the CMakeLists.txt if possible.) Please tell me what correction I have to do to get *this* working now?
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
Code:
//#include <QtGui/QWidget>
#include <QtWidgets/QtWidgets>
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
No, the module name is not needed in the include (especially not the Qt5 one saman_artorious suggests).
Add QtGui and maybe QtCore to the COMPONENTS in your CMakeLists.txt
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
Quote:
Originally Posted by
ChrisW67
No, the module name is not needed in the include (especially not the Qt5 one saman_artorious suggests).
Add QtGui and maybe QtCore to the COMPONENTS in your CMakeLists.txt
Hi thank you very much -- I definitely preferred to not touch the sources and your suggestion worked (yes I needed to include QtCore too -- apparently there was #include <QSet> in there). BTW presumably the authors' CMake script worked at the time of their upload -- any idea it does not work now?
Re: error "variable set to NOTFOUND" in compiling a Qt project wtih CMake
The problem would appear to be a change in the behaviour of the CMake Qt4 find module, not Qt.