trouble using cgal and cmake - cmake

I have to do a project using CMake and the CGAL geometry library but, regardless having tried everything I can find online, I still can't figure out how to configure my project in CMake. I have installed all the libraries CGAL depends on and qt5 but CMake keeps giving me errors when I try to configure and generate. I am almost a beginner so any kind of help would be very useful. I am using windows 10 and visual studio 2019. Following are the errors it's giving me.
CMake Warning at CMakeLists.txt:5 (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.
CMakeLists.txt
cmake_minimum_required(VERSION "3.22.0-rc2")
project("TesiLaurea")
find_package(CGAL)
add_executable("${PROJECT_NAME}" "Main.cpp")
target_link_libraries("${PROJECT_NAME}" CGAL::CGAL)

Related

Build problems with test Project trying to use zeromq

I have tried for a day to try and resolve issues with the cmake when trying to build a project using the zeromq library. I appreciate that there have been several threads on this question in the past, but none seem to explain the fix in any detail. I've exhausted my knowledge regarding how to solve this one and would appreciate an explanation as to what I need to do.
Below is the following error message from the project cmake command issued inside CLion.
The cmake Error occurs at line 1 of vcpkg-cmake-wrapper.cmake proving that it was found.
Could not find a package configuration file provided by "zeromq" with
any of the following names:
zeromqConfig.cmake
zeromq-config.cmake
Add the installation prefix of "zeromq" to CMAKE_PREFIX_PATH or set
"zeromq_DIR" to a directory containing one of the above files. If "zeromq"
provides a separate development package or SDK, be sure it has been
installed.
Where does this package config file go and what is in it? What is meant by adding the installation prefix to CMAKE_PREFIX_PATH?
I installed zeromq using vcpkg. The output from vcpkg list is
cppzmq:x64-linux 4.8.1#1 Header-only C++ binding for ZeroMQ
zeromq:x64-linux 4.3.4#6 The ZeroMQ lightweight messaging kernel is a lib...
So to me this looks like the library downloaded, built and installed correctly.
My cmake toolchain options are:
-DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
/vcpkg/installed/x64-linux/share/zeromq/vcpkg-cmake-wrapper.cmake:1
CMakeLists.txt is:
cmake_minimum_required(VERSION 3.24.0)
project(Template VERSION 1.0.0)
add_executable(template src/main.cpp)
find_package(zeromq CONFIG REQUIRED)
find_package(cppzmq CONFIG REQUIRED)
target_compile_features(Template PRIVATE cxx_std_17)
target_link_libraries(main
PRIVATE
zeromq::zeromq
cppzmq::cppzmq)
This is currently an empty project until I get cmake process to resolve the library
I have tried to understand by following the example on: https://vcpkg.readthedocs.io/en/latest/examples/manifest-mode-cmake/ From this I can successfully build and create an executable.
Thanks Tsyvarev. I achieved an error free CMake by changing my CMakeLists.txt to:
cmake_minimum_required(VERSION 3.24.0)
project(Template VERSION 1.0.0)
#set(zeromq_DIR "~/usr/local/lib/cmake/ZeroMQ")
add_executable(Template src/main.cpp)
find_package(ZeroMQ CONFIG REQUIRED)
target_compile_features(Template PRIVATE cxx_std_17)
target_link_libraries(Template
PRIVATE
ZeroMQ)

cmake not finding package configuration file

I am using Qt Creator as IDE and MSVC 2019.
I built and installed the pagmo library from the source. Now I am trying to use it for my project.
Even though the installation seems fine, when I try to load it I get strange errors, telling me that "pagmo" is not found. In particular:
error:
By not providing "FindPagmo.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Pagmo",
but CMake did not find one.
Could not find a package configuration file provided by "Pagmo" with any
of the following names:
PagmoConfig.cmake
pagmo-config.cmake
Add the installation prefix of "Pagmo" to CMAKE_PREFIX_PATH or set
"Pagmo_DIR" to a directory containing one of the above files. If
"Pagmo" provides a separate development package or SDK, be sure it has
been installed.
In my CMakeLists.txt I have set the following command:
find_package(Pagmo REQUIRED)
Now, as far as I know FindPagmo.cmake does not exist, BUT I am giving as input parameter Pagmo_DIR, which contains the file pagmo-config.cmake. I can't understand why CMake is not finding it. I also tried to set CMAKE_MODULE_PATH to the same folder but nothing changed.
Does anybody have suggestions on how to solve this problem?
I am setting pagmo directory as follows:
-DPagmo_DIR = C:\Lib\pagmo\install\debug\lib\cmake\pagmo
in that folder I have the following files:
Findpagmo_IPOPT.cmake;
pagmo_export.cmake;
pagmo_export-debug.cmake;
pagmo-config.cmake;
pagmo-config-version.cmake;
PagmoFindBoost.cmake

How to perform the "make install" step after building aws-sdk-cpp using Qt Creator and CMake

I am trying to add aws-sdk-cpp as a submodule in my Qt application using Qt Creator and CMake. I want it to build for any platform without doing the building and installing on the command line as described here.
My project structure and CMakeLists.txt files looks like this:
I have successfully built the entire aws-sdk-cpp using MSVC2019 in debug mode using Qt Creator. My projects build folder is now 15 GB containing all the built libraries. The current issue I'm now facing is this error:
CMake Error at app/CMakeLists.txt:23 (find_package):
By not providing "FindAWSSDK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "AWSSDK", but
CMake did not find one.
Could not find a package configuration file provided by "AWSSDK" with any
of the following names:
AWSSDKConfig.cmake
awssdk-config.cmake
Add the installation prefix of "AWSSDK" to CMAKE_PREFIX_PATH or set
"AWSSDK_DIR" to a directory containing one of the above files. If "AWSSDK"
provides a separate development package or SDK, be sure it has been
installed.
I think what is missing is the make install step described here and to set the path to AWSSDK_DIR.
I'm very new to CMake and I have not found any way to perform the make install step in the CMakeLists.txt file and then be able to set the AWSSDK_DIR which points to the AWSSDKConfig.cmake or awssdk-config.cmake file missing.
I'm also not sure which CMakeLists.txt file this should be written or if there is an entire other way to do this? Currently I'm stuck getting nowhere..

kdev-ruby's CMakeFile.txt requires weird stuff like KF5Config.cmake

I'm trying to compile a Ruby plugin for KDevelop: https://github.com/KDE/kdev-ruby
When I cut a folder called build, cd build, and run cmake .., I get lots of errors:
CMake Error at CMakeLists.txt:13 (include):
include could not find load file:
KDEInstallDirs
CMake Error at CMakeLists.txt:14 (include):
include could not find load file:
KDECMakeSettings
CMake Error at CMakeLists.txt:15 (include):
include could not find load file:
KDECompilerSettings
CMake Error at CMakeLists.txt:16 (include):
include could not find load file:
ECMQtDeclareLoggingCategory
CMake Error at CMakeLists.txt:24 (find_package):
By not providing "FindKF5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "KF5", but
CMake did not find one.
Could not find a package configuration file provided by "KF5" (requested
version 5.15.0) with any of the following names:
KF5Config.cmake
kf5-config.cmake
Add the installation prefix of "KF5" to CMAKE_PREFIX_PATH or set "KF5_DIR"
to a directory containing one of the above files. If "KF5" provides a
separate development package or SDK, be sure it has been installed.
How, on Ubuntu, do I install something that provides KF5Config.cmake? Preferably without rebuilding KDevelop or KDE or Qt5.
KDevelop relies on the development headers for various libraries, and finds them via the accompanying CMake files.
The build also uses CMake modules provided by the extra-cmake-modules package.
You must install that and libkf5config-dev.
The apt-file command might help you find the relevant packages for your distro in these situations.

Windows 10, VS 2013: Cmake error while configuring OpenCL program

I'm trying to build this Github project in Windows. Getting the error below. I've installed the AMD SDK and added the path to PATH variable. Please let me know how to overcome this issue.
CMake Error at CMakeLists.txt:94 (find_package):
By not providing "FindOpenCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCL", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCL" with any
of the following names:
OpenCLConfig.cmake
opencl-config.cmake
Add the installation prefix of "OpenCL" to CMAKE_PREFIX_PATH or set
"OpenCL_DIR" to a directory containing one of the above files. If "OpenCL"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
According to docs, CMake provides FindOpenCL.cmake module since version 3.1. So you need at least CMake 3.1 for build given project.
Actually, it is the project's cmake_minimum_required who should provide correct constraint.