My linux machine has directory /usr/local/include/vtk-8.2/
How can cmake find this directory using glob expression “vtk-8”?
I tried this:
file(GLOB result LIST_DIRECTORIES true RELATIVE /usr/local “*vtk-8*”)
But ${result} is empty.
What am I doing wrong?
Thanks!
Why do you want to find this directory by globbing? Is find_package(VTK)
not working?
1 Like
Correct, find_package(vtk) is not working on this machine. I built vtk-8.2 from source, followed by ‘make install’ which put code in /usr/local/include/vtk-8.2, and libraries in /usr/local/lib. Yet find_package() does not find the include directory.
Does passing --debug-find
to cmake
give you any indication why it might be rejecting it?
I try to vtk with find_package:
find_package(VTK)
message("VTK_FOUND: ${VTK_FOUND}")
message("VTK_INCLUDE_DIRS: ${VTK_INCLUDE_DIRS}")
message("VTK_LIBRARIES: ${VTK_LIBRARIES}")
Which returns VTK_FOUND=1 and VTK_LIBRARIES, but VTK_INCLUDE_DIRS is blank:
VTK_FOUND: 1
VTK_INCLUDE_DIRS:
VTK_LIBRARIES: VTK::WrappingTools;VTK::ViewsQt;VTK::ViewsInfovis;VTK::CommonColor;VTK::ViewsContext2D;VTK::loguru;VTK::TestingRendering;VTK::TestingCore;VTK::vtksys;VTK::RenderingQt;VTK::PythonCon (et cetera...)
When I use --debug-find to cmake, there is a lot of output from find_package(VTK), most of which I don’t understand. But no obvious error in there.
I do see file /usr/local/lib/cmake/vtk-8.2, which contains many *.cmake files. But I don’t see a corresponding /usr/local/include/cmake directory, despite the presence of /usr/local/include/vtk-8.2.
Thanks!
It seems that cmake’s glob expressions never match the path separator character ‘/’. This returns the expected result:
file(GLOB result LIST_DIRECTORIES true RELATIVE /usr/local “/usr/local/*/*vtk-8*”)
I.e. the glob expression must hard-code ‘/’. I do not see cmake’s glob expression rules anywhere - are they documented?
This is VTK 9, not 8.2 (or the 8.90 pre-release era). I have no idea why it thinks it is 8.2 here. What is ${VTK_VERSION}
? VTK 8.90 and newer do not have any include directories provided as a variable because they are not needed. The targets provide the usage requirements, so all you need to do is target_link_libraries(mytgt ${vis} VTK::CommonCore)
for whatever modules you need to use.