# Cylinder Example Cannot be Created by CMake

**URL:** https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233
**Category:** Support
**Created:** [April 7, 2022, 3:59pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233 "2022-04-07T15:59:31Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 3:59pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/1 "2022-04-07T15:59:31Z")

</div>

I have obtain VTK’s sources locally by:  
`git clone --recursive https://gitlab.kitware.com/vtk/vtk.git`

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:  
[CylinderExample](https://kitware.github.io/vtk-examples/site/Cxx/GeometricObjects/CylinderExample/)

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?

 ![1](https://discourse.vtk.org/uploads/default/original/2X/2/2ff72ea79e0b37136d1af7fda94283bd792c834e.png)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 6:12pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/2 "2022-04-07T18:12:37Z")

</div>

Hello,

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.

cheers,

Paulo

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 8:18pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/3 "2022-04-07T20:18:30Z")

</div>

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

**if (NOT VTK\_FOUND)**  
\*\* message(“Skipping CylinderExample: ${VTK\_NOT\_FOUND\_MESSAGE}”)\*\*  
\*\* return()\*\*  
**endif()**

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

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [April 7, 2022, 8:31pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/4 "2022-04-07T20:31:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 8:45pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/5 "2022-04-07T20:45:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 8:45pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/6 "2022-04-07T20:45:29Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:01pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/7 "2022-04-07T21:01:41Z")

</div>

I try to edit VTK\_DIR-NOTFOUND in ccmake for the Cylinder Example into:  
**/opt/hamzstlib/vtk/CMake**

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 [https://vtk.org/download/](https://vtk.org/download/)
2. git clone [GitHub - Kitware/VTK: Mirror of Visualization Toolkit repository](https://github.com/Kitware/VTK.git)
3. git clone [https://gitlab.kitware.com/vtk/vtk.git](https://gitlab.kitware.com/vtk/vtk.git) VTK

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

 ![1-vtk](https://discourse.vtk.org/uploads/default/original/2X/0/0b71e5e7e8fd8c5df544c52cfc85f167bc33789a.png)  
 ![1-vtk2](https://discourse.vtk.org/uploads/default/original/2X/7/7d459f954c22898b0a5a4417acef7a55e80c256e.png)

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:02pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/8 "2022-04-07T21:02:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:05pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/9 "2022-04-07T21:05:00Z")

</div>

No,

> [@Paulo\_Carvalho](#):
>
> 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`.

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

---

<div class="post-metadata">

### Author: ![mchinand](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/a587f6/32.png) [@mchinand](https://discourse.vtk.org/u/mchinand)
#### Post date: [April 7, 2022, 9:05pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/10 "2022-04-07T21:05:37Z")

</div>

Did you build and install VTK?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:09pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/11 "2022-04-07T21:09:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:12pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/12 "2022-04-07T21:12:46Z")

</div>

Thanks for all your helps,  
I downloaded [VTK-9.1.0.tar.gz](https://www.vtk.org/files/release/9.1/VTK-9.1.0.tar.gz) from this:  
[https://vtk.org/download/](https://vtk.org/download/)

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**

 ![1-vtk](https://discourse.vtk.org/uploads/default/original/2X/4/45fd848b08832c35e81e4172e89372b05f0278e3.png)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:19pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/13 "2022-04-07T21:19:54Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:23pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/14 "2022-04-07T21:23:20Z")

</div>

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

There are only `/build`, `vtk-9.1.0.data`, `vtk.py` 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?**

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:24pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/15 "2022-04-07T21:24:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:24pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/16 "2022-04-07T21:24:28Z")

</div>

> [@Freya\_the\_Goddess](#):
>
> Is the installation wrong by not having `/lib` folder?

Yes, it is.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:25pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/17 "2022-04-07T21:25:31Z")

</div>

> [@Freya\_the\_Goddess](#):
>
> So what is the contents inside `/opt/hamzstlib/Vtk9/lib/cmake/vtk-9.1`

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

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:26pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/18 "2022-04-07T21:26:07Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [April 7, 2022, 9:29pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/19 "2022-04-07T21:29:46Z")

</div>

The last command in here:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/3aad5e332a54a21e01daa97093232522416ed04b.png)  
Should be a `ninja -j4 install`.

---

<div class="post-metadata">

### Author: ![Freya\_the\_Goddess](https://discourse.vtk.org/user_avatar/discourse.vtk.org/freya_the_goddess/32/4942_2.png) [@Freya\_the\_Goddess](https://discourse.vtk.org/u/Freya_the_Goddess)
#### Post date: [April 7, 2022, 9:30pm UTC](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233/20 "2022-04-07T21:30:50Z")

</div>

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

[Next page](https://discourse.vtk.org/t/cylinder-example-cannot-be-created-by-cmake/8233.md?page=2)
