Cylinder Example Cannot be Created by CMake

I have obtain VTK’s sources locally by:
git clone --recursive

then I enter the vtk folder and build it using CMake. A build folder is created then I want to test it by following this link:

I try to CMake the CylinderExample from the build folder but it said Skipping CylinderExample, thus no CylinderExample file is created as the output.

What is wrong with this?


It looks fine to me. CMake is a meta-make program, that is, a make that makes Makefiles. In that build directory you will find a file called Makefile. Now you need to run make to build the example.



No if I see the source code of CMakeLists.txt:

** message(“Skipping CylinderExample: ${VTK_NOT_FOUND_MESSAGE}”)**
** return()**

then my VTK is not detected, how to solve this?

use cmake-gui or ccmake to fill the required properties and provide the path to your VTK build tree.

I use ccmake and then edit VTK_DIR to my build directory of VTK it still Skipping ClylinderExample.

I see…

It seems to me that VTK_DIR passed in the command prompt is pointing to the VTK’s build directory. It should point to the installation directory. More specifically to where VTK’s *.cmake files are, for example, /usr/lib64/vtk-9.1.0/lib/cmake/vtk-9.1.

I try to edit VTK_DIR-NOTFOUND in ccmake for the Cylinder Example into:

The /opt/hamzstlib/vtk is the source directory that I get by git clone VTK repository.

I just want to confirm which VTK should I download?

  1. The VTK-9.1.0 from
  2. git clone GitHub - Kitware/VTK: Mirror of Visualization Toolkit repository
  3. git clone VTK

which one to make sure I can build VTK right? or any of them are okay?

By changing the VTK_DIR to the place where *.cmake are found (which is the source directory of my downloaded VTK) it still Skipping CylinderExample


Not the source directory. The installation directory is where the libvtk*.so files are.

Did you build and install VTK?

After you build VTK, you must install it with a make install run from the VTK build directory. After that, you will have the libraries, headers and CMake files in the directory that appears in CMAKE_INSTALL_PREFIX in VTK’s CMake configuration.

Thanks for all your helps,
I downloaded VTK-9.1.0.tar.gz from this:

Then I extract it and run the CMake command as you can see in the picture below, after that the compiled result is inside the build folder.

Then form the build folder I run “ninja install” since I am using ninja to compile.
So should I use make instead of ninja?

The ninja install result can be seen inside the /opt/hamzstlib/Vtk9

You can use Ninja if you like. From that configuration screen, the installation directory is /opt/hamzstlib/Vtk9. After a [ninja|make] install on VTK’s build directory, you can do the Cylinder Example build by setting VTK_DIR to /opt/hamzstlib/Vtk9/lib/cmake/vtk-9.1.

Under the /opt/hamzstlib/Vtk9
there is no /lib

There are only /build,, and vtkmodules

So what is the contents inside /opt/hamzstlib/Vtk9/lib/cmake/vtk-9.1. ?

Is the installation wrong by not having /lib folder?

If you are using Ninja, don’t forget to pass -GNinja in the cmake command.

Yes, it is.

The CMake scripts that CMake will use to find all the libraries automatically in order to build the Cylinder example.

I passed -GNinja in the cmake command.

So how to do installation right with Unix system?
what is the cmake installation scripts that should be correct?

The last command in here:
Should be a ninja -j4 install.

Alright I will try it and get back to you, thank you.

1 Like