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

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.

Related

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

Why I can't build opencv WITH_QT?

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.

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.

Introducing library paths in CMake

I want to build a project which requires opencv.
I have set up opencv and added these variables to environment variables:
OPENCV_DIR -> c:\opencv\build\x86\vc12
PATH -> %OPENCV_DIR%\bin
Then I do the following:
mkdir build
cd build
set OpenCV_DIR="C:\opencv\build"
cmake -G "Visual Studio 14 2015" -D OpenCV_DIR=%OpenCV_DIR% ..
But I get these errors:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.6/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.
Boost version: 1.61.0
Boost include path: C:/Program Files/boost_1_61_0
Could not find the following Boost libraries:
boost_system
boost_filesystem
boost_signals
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:88 (find_package)
CMake Error at CMakeLists.txt:89 (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.
-- Configuring incomplete, errors occurred!
See also "C:/Users/vahab/Desktop/PartsBasedDetector-master/PartsBasedDetector-master/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/vahab/Desktop/PartsBasedDetector-master/PartsBasedDetector-master/build/CMakeFiles/CMakeError.log".
For now I don't care about the error with boost library. I just want to know why it doesn't find opencv while I have set up the related variables. I have explored other stackoverflow pages but found no working answer. Can anyone help?
Thanks

qt creator opencv windows cmake error

I want to configure and then generate opencv library for qt creator to link them.
I opened cmake 3.1.0 and typed in the source and build path.
source:
C:/Users/Philipp_Laptop/Downloads/opencv/sources
build: C:/opencv-mingw
Then I configured the mingw-compiler with the path:
C:/Qt/Tools/mingw482_32/bin/gcc.exe
C:/Qt/Tools/mingw482_32/bin/g++.exe
After successful configure i set the with_Qt option.
I configured it twice and it shows me the following error:
Detected version of GNU GCC: 48 (408)
CMake Warning (dev) at cmake/OpenCVUtils.cmake:261 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "WIN32" will no longer be dereferenced when the
policy is set to NEW. Since the policy is not set the OLD behavior will be
used.
Call Stack (most recent call first):
CMakeLists.txt:127 (OCV_OPTION)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Core" with any
of the following names:
Qt5CoreConfig.cmake
qt5core-config.cmake
Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
"Qt5Core_DIR" to a directory containing one of the above files. If
"Qt5Core" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Gui", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Gui" with any
of the following names:
Qt5GuiConfig.cmake
qt5gui-config.cmake
Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
"Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Test", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Test" with any
of the following names:
Qt5TestConfig.cmake
qt5test-config.cmake
Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
"Qt5Test_DIR" to a directory containing one of the above files. If
"Qt5Test" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5Concurrent", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Concurrent"
with any of the following names:
Qt5ConcurrentConfig.cmake
qt5concurrent-config.cmake
Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
"Qt5Concurrent_DIR" to a directory containing one of the above files. If
"Qt5Concurrent" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
CMakeLists.txt:447 (include)
Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - 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
Found OpenGL: opengl32
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE) (found version "4.8.6")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.1/Modules/FindQt4.cmake:1331 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:447 (include)
Configuring incomplete, errors occurred!
See also "C:/opencv-mingw/CMakeFiles/CMakeOutput.log".
See also "C:/opencv-mingw/CMakeFiles/CMakeError.log".
I used CMake GUI under Windows for this so I'll refer to this approach.
Let's start from problems related to CMAKE_PREFIX_PATH not defined.
To solve this you simply have to press ADD on the CMAKE GUI and add the variable of type PATH named CMAKE_PREFIX_PATH with value C:/Bin/Qt/5.3/mingw482_32/lib/cmake/ but using your own installation of Qt5. The directory you point now contains all modules you need: Qt5 directory, Qt5AxBase...
At this point you press configure and you should have QT_QMAKE_EXECUTABLE not valid. You need to set it properly, in my case: C:/Bin/Qt/5.3/mingw482_32/bin/qmake.exe.
Then press configuration again and see if some error is still present (you have others error I never saw but maybe they are consequence of the previous ones), in my case this solved all issues and the build proceeded.
The MINGW configuration seems to be fine: I did slightly different just putting the bin MINGW path in PAT variable as first entry and using the default compiler from CMAKE (but your solution is as valid as my one).