![cmake add library cmake add library](https://resources.jetbrains.com/help/img/idea/2021.1/cl_cmake_add_existing_files.png)
Library lets you declare a header-only library as a proper CMake target, and Using header-only libraries in CMake is a breeze. Use ExternalProject_Add to obtain, configure, and build the library.
![cmake add library cmake add library](https://i.imgur.com/8ILWwDG.png)
![cmake add library cmake add library](https://visualgdb.com/w/wp-content/uploads/2017/06/02-cmakesys.png)
#CMAKE ADD LIBRARY FULL#
LibvtkFiltersSources-8.2.so.1 => correct full path to library
![cmake add library cmake add library](https://visualgdb.com/w/wp-content/uploads/2017/06/04-prj-1024x695.png)
Running ldd on the resulting executable gives: The RPATH is not set … and LD_LIBRARY_PATH does not contain “/home/me/opt/vtk/lib” (and I would rather not set LD_LIBRARY_PATH - although I will if I have to). Project(“Display Sphere Example”) set(VTK_DIR /home/me/opt/vtk/lib/cmake/vtk-8.2)Īfterwards, the executable built without error, but when running it, it appears that there are some VTK libraries that are not found (and confusingly, some are found)? Running “readelf -d” on the resulting executable gives the correct RUNPATH: I did not use the CMakeLists.txt file in the example, but I did use it as a guide for what I wrote: I copied the sphere example into a directory. My system is Ubuntu 19.10, with kernel 5.3.0-42-generic. I built VTK from source (8.2.0) and I am using CMake 3.13.