PDA

View Full Version : Qt cmake project cannot find pakages



the_dew
22nd October 2011, 05:32
Hello there,

I have an external project that has been set up to use CMake for compilation. I was just using a text editor and compiling at the command line but have decided to use Qt creator for the benefits an IDE bring.

I followed the instructions for setting up a CMake project by opening the CMakeLists.txt file in my top directory. CMake runs but it cannot find some packages using pkgconfig, specifically OpenCV. Qt cannot build the project now because there is a lot of code dependant on OpenCV.

If I run CMake at the command line it finds the OpenCV package. I'm at a loss as to why running CMake through Qt creator would cause a problem. The CMakeLists.txt files are all the same!!

I've run


daniel@daniel-linux:~$ pkg-config --cflags --libs opencv
-I/opt/opencv-2.0.0/include/opencv -I/opt/opencv-2.0.0/include -L/opt/opencv-2.0.0/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

at the command line and opencv can be found.

I'm using ubuntu 10.10, Qt creator 2.0.1 (based on Qt 4.7.0), CMake 2.8-patch 3 and trying to find OpenCV 2.0.0 which is installed in as above

Am I missing a config param somewhere? Do I need to modify the PATH? Thought this is all handled in the CMakeLists.txt files.

Any ideas?

andrea.delprete
7th May 2014, 14:05
I know this is a pretty old post, but I am experiencing the exact same problem. Does anybody know how to solve it?

ChrisW67
8th May 2014, 00:37
There is a difference in the environment between the command line where CMake finds the OpenCV install, and the environment that QtCreator is running the same CMake command and failing. I'd look at the PKG_CONFIG_PATH environment variable in both places (the error message from pkg-config tells you that when it fails).