Why I can't build opencv WITH_QT? - c++

I've installed Qt5.12 on my Windows 7 x64. And CMake 3.16.
I want to build OpenCV-4.1.2. So in cmake I've checked WITH_QT and specified QT5_DIR as: C:\\Qt\\5.12.6 and then I click Configure. But I get this error:
CMake Error at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
CMakeLists.txt:669 (include)"

I've finally figured it out: I've made a search inside the Qt directory for Qt5Config.cmake and found it in: "C:\Qt\5.12.6\msvc2017_64\lib\cmake\Qt5".
Now I specify this directory in CMake and click configure. Everything works fine. Thank you guys.

Related

Where is OpenGLConfig.cmake located on mac?

I'm using OpenGL with a C++ project. When I run configure in cmake-gui I get the following error:
CMake Error at CMakeLists.txt:18 (find_package):
Could not find a package configuration file provided by "OpenGL" with any
of the following names:
OpenGLConfig.cmake
opengl-config.cmake
Add the installation prefix of "OpenGL" to CMAKE_PREFIX_PATH or set
"OpenGL_DIR" to a directory containing one of the above files. If "OpenGL"
provides a separate development package or SDK, be sure it has been
installed.
Presumably, I have to set the OpenGL_DIR value but I can't find where OpenGLConfig.cmake file is located on mac.

Cmake not able to find CGAL library(installed using vcpkg)

This is the error message:
CMake Error at D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake:788 (_find_package):
By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CGAL", but
CMake did not find one.
Could not find a package configuration file provided by "CGAL" with any of
the following names:
CGALConfig.cmake
cgal-config.cmake
Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
"CGAL_DIR" to a directory containing one of the above files. If "CGAL"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:16 (find_package)
I am trying to use the vcpkg toolchain file when building the project in Cmake; so all my installed libraries are available for Cmake but it is not working.

catkin can't find qt_build after sudo upgrade

I was working on my project and I accidentally did sudo apt-get upgrade.
Now I have some issues that I don't understand.
When I do catkin_make in my workspace, it says that cannot find the qt_build package and that I need to install it in CMAKE_PREFIX_PATH.
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
Could not find a package configuration file provided by "qt_build" with any
of the following names:
qt_buildConfig.cmake
qt_build-config.cmake
Add the installation prefix of "qt_build" to CMAKE_PREFIX_PATH or set
"qt_build_DIR" to a directory containing one of the above files. If
"qt_build" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
motion_manager/CMakeLists.txt:31 (find_package)
---Could not find the required component 'qt_build'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "qt_build" with any
of the following names:
qt_buildConfig.cmake
qt_build-config.cmake
Add the installation prefix of "qt_build" to CMAKE_PREFIX_PATH or set
"qt_build_DIR" to a directory containing one of the above files. If
"qt_build" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
motion_manager/CMakeLists.txt:31 (find_package)
However, the package qt_build is already in that directory.
joao#joao-X580VD:~/ros_ws$ echo $CMAKE_PREFIX_PATH
/opt/ros/kinetic
joao#joao-X580VD:~/ros_ws$ cd /opt/ros/kinetic
joao#joao-X580VD:/opt/ros/kinetic$ locate qt_build
/opt/ros/kinetic/lib/pkgconfig/qt_build.pc
/opt/ros/kinetic/share/qt_build
/opt/ros/kinetic/share/qt_build/cmake
/opt/ros/kinetic/share/qt_build/package.xml
/opt/ros/kinetic/share/qt_build/cmake/qt-ros.cmake
/opt/ros/kinetic/share/qt_build/cmake/qt_buildConfig-version.cmake
/opt/ros/kinetic/share/qt_build/cmake/qt_buildConfig.cmake
/snap/kde-frameworks-5-core18/32/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_config.prf
/snap/kde-frameworks-5-core18/32/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_extra.prf
/snap/kde-frameworks-5-core18/32/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_paths.prf
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_config.prf
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_build_paths.prf
Before the upgrade everything was working fine, but now I get this error.
Does anyone know how to solve such problem? Thank you

Compiling with CMake and ITK error

I'm trying to compile some code from here using CMake and ITK but I'm running into an error.
In CMake I select the source folder at /utilities/ITKImageSeriesToVolume and the build folder at /utilities/ITKImageSeriesToVolume/build. This however gives me an error:
CMake Error at CMakeLists.txt:42 (find_package):
By not providing "FindITK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ITK", but
CMake did not find one.
Could not find a package configuration file provided by "ITK" with any of
the following names:
ITKConfig.cmake
itk-config.cmake
Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
to a directory containing one of the above files. If "ITK" provides a
separate development package or SDK, be sure it has been installed.
I have tried to set a CMAKE_PREFIX_PATH environment variable that points to the root folder of ITK containing ITKConfig.cmake but get the same error.
Hoping someone can help, thanks in advance.
EDIT: After setting ITK_DIR to the root ITK folder I get:
CMake Error at D:/Apps/InsightToolkit/ITK/ITKConfig.cmake:48 (include):
include could not find load file:
D:/Apps/InsightToolkit/Build/ITKTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:42 (find_package)
CMake Error at D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:56 (message):
No such module: "ITKDoubleConversion"
Call Stack (most recent call first):
D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:26 (itk_module_load)
D:/Apps/InsightToolkit/Source/CMake/ITKModuleAPI.cmake:84 (_itk_module_config_recurse)
D:/Apps/InsightToolkit/ITK/ITKConfig.cmake:68 (itk_module_config)
CMakeLists.txt:42 (find_package)
It has a simple fix as mentioned in the ERROR
"Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
to a directory containing one of the above files. If "ITK" provides a
separate development package or SDK, be sure it has been installed."
Make sure your point the CMAKE_PREFIX_PATH and ITK to your ITK Build Directory. This is assuming you have already build ITK using Cmake atleast once.
Steps
1) Create ITK source folder.
2) Create ITK build folder.
3) Run CMake and select source and build folders.
4) Select respective compiler, and if there are any compiler issues refer this discussion.
5) Configure and generate cmake.
6) Open the build files in build folder with respective IDE (use .sln file if visual studio compilers are used).
7) Build all once on visual studio.
8) Now for your new project use same steps and point CMAKE_PREFIX_PATH and ITK to your ITK Build Directory.
And everything should work.
Good Luck!!!
Your ITK build seems to be partly broken. Can you try re-building it? If that does not help, see whether ITK_USE_SYSTEM_DOUBLECONVERSION is ON. That means not to build DoubleConversion library which comes with ITK but to use the one already present on the system. If it is not present, you have a problem.
Also, unless ITK_BUILD_DEFAULT_MODULES is ON, you have to specifically turn on each module or module group you want to be compiled. In that case, turn on ITKDoubleConversion, and any additional modules which that code requires.

OpenCV Environment variable changed

I had my standalone installation of OpenCV on my Linux machine and it was running OK. I installed ROS (comes with its OpenCV) and today I cannot run my CMakeLists.txt in any of my OpenCV projects, getting the error of :
CMake Error at CMakeLists.txt:20 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
I am kinda sure this happened because some environment variable got changed however I don't know where to look at.
Could someone walk me through this?
Reinstalling OpenCV solved the problem for me, since it re-modified the Environment variable.