CMAKE TASKING TOOLSET Usage - cmake

I am quite new to cmake. Cmake had recently added support for TASKING Tool Set
https://cmake.org/cmake/help/latest/variable/CMAKE_TASKING_TOOLSET.html
While searching on Github, I found the following information:
https://github.com/Kitware/CMake/blob/master/Modules/Compiler/Tasking-C.cmake
Unfortunately, I am unable to understand this. Can you please help me to write a CMakeLists.txt file to configure the TASKING tool set in cmake?
https://github.com/Kitware/CMake/blob/master/Modules/Compiler/Tasking-C.cmake
I don't know how to use this file.

Related

trouble using cgal and 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)

CMake Error with Eigen 3.3.4

I am trying to compile dolfin on openSUSE Leap 42.3. I get an error with CMake when it tries to find Eigen3. I have Eigen3.3.4 installed on my machine and the error is
CMake Error at cmake/modules/FindEigen3.cmake:42 (file):
file failed to open for reading (No such file or directory):
/usr//usr/include/eigen3/Eigen/src/Core/util/Macros.h
I don't know why the extra /usr/ is popping up at the beginning. Can anyone help me? I can't find a solution online.
Okay, this was an...interesting, but perhaps silly error. Forgive me...I'm new to openSUSE. I originally installed eigen3 through YaST. This did not come with a CMakeList.txt file, so naturally I was confused by the answer in c++ - Unable to find Eigen3 with CMake. Moreover I was confused because Eigen is just header files, so naturally I assumed there would be nothing to make.
Long story short, there are MakeList's for Eigen. You just have to download the tarball from eigen.tuxfamily.org, then build them with cmake.
dolfin? I want to know are you in the CFD area.
I also have Eigen installed in my leap 42.3. But i installed it from the official website of Eigen. I think you may have a try and then specify the folder of the Eigne in Cmake-gui.
Good luck to you.

CMake could not find the VTKConfig.cmake

I'm trying to compile a program in CMake but I'm getting this error.
By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "VTK", but
CMake did not find one.
Could not find a package configuration file provided by "VTK" (requested
version 6.1) with any of the following names:
VTKConfig.cmake
vtk-config.cmake
I can't find the relevant files (VTKConfig.cmake or vtk-config.cmake) on the machine but do have VTKConfig.cmake.in (which also doesn't work).
Does anyone know where I can download the file from, or what I might be doing wrong.
It seems like you just have the VTK source code but haven't built it yet. VTKConfig.cmake.in is a template used by CMake to generate the VTKConfig.cmake file in the build and install directory. Look at http://www.vtk.org/Wiki/VTK/Building to see how to build VTK.
When you have successfully built VTK you can give CMake a hint where to look for VTK with the VTK_DIR-parameter:
cmake -DVTK_DIR=/path/to/vtk/build-directory /path/to/your/source-directory
If you have successfully built VTK, you would end up with a VTK-Release-build folder containing all the build files, one of which is VTKConfig.cmake. Your program is not able to find this file. You just need to set an environment variable named VTK_DIR before running your program. You can do so by running:
export VTK_DIR=/path/to/VTK-Release-build/
"FindVTK.cmake"the file of cmake is made in build directry.
please add this Path. export VTK_DIR=/path/VTK-Release-version/build

Package vs Library

I've just started working with CMake and I noticed that they have both a find_package and a find_library. And this confuses me. Can somebody explain the difference between a package and a library in the world of programming? Or, in the world of CMake?
Appreciate it, guys!
Imagine you want to use zlib in your project, you need to find the header file zlib.h, and the library libz.so (on Linux). You can use the low-level cmake commands find_path and find_library to find them, or you can use find_package(ZLIB). The later command will try to find out all what is necessary to use zlib. It can be extra macro definitions, or dependencies.
Update, more detail about find_package: when the CMake command find_package(SomeThing) is called, as in the documentation, there are two possible modes that cmake can run:
the module mode (that searches for a file FindSomeThing.cmake)
or the config mode (that searches for a file named SomeThingConfig.cmake)
For ZLIB, there is a module named FindZLIB, shipped with CMake itself (on my Linux machine that is the file /usr/share/cmake/Modules/FindZLIB.cmake). That module is a CMake script that uses the CMake API to search for ZLIB files in default locations, or ask the user for the location if it cannot be found automatically.

llvm's cmake integration

I'm currently building a compiler/interpreter in C/C++.
When I noticed LLVM I thought it would fit greatly to what I needed and so I'm trying to integrate LLVM in my existing build system (I use CMake).
I read this bout integration of LLVM in CMake. I copy and pasted the example CMakeLists.txt, changed the LLVM_ROOT to ~/.llvm/ (that's where I downloaded and build LLVM and clang) and it says it isn't a valid LLVM-install. Best result I could achieve was the error message "Can't find LLVMConfig" by changing LLVM_ROOT to ~/.llvm/llvm.
My ~/.llvm/ folder looks like this:
~/.llvm/llvm # this folder contains source files
~/.llvm/build # this folder contains object, executable and library files
I downloaded LLVM and clang via SVN. I did not build it with CMake.
Is it just me or is something wrong with the CMakeLists.txt?
This CMake documentation page got rotted, but setting up CMake for LLVM developing isn't different from any other project. If your headers/libs are installed into non-standard prefix, there is no way for CMake to guess it.
You need to set CMAKE_PREFIX_PATH to the LLVM installation prefix or CMAKE_MODULE_PATH to prefix/share/llvm/cmake to make it work.
And yes, use the second code snippet from documentation (under Alternativaly, you can utilize CMake’s find_package functionality. line).