I am new with building software using cmake.

I want to install VTK using cmake. I downloaded the .tar file and un-tared it. This leaves me with a directory that contains some cmake files and some other stuff.

Suppose I have un-tared all files in the directory /HOME/USER/SETUP_FILES/ and created a directory /HOME/USER/SETUP_FILES/BUILD

When I cd into /HOME/USER/SETUP_FILES/BUILD and execute cmake ../. I am able to configure the build.

In the configuration file, I can choose to define CMAKE_INSTALL_PREFIX

My first question is:

1) What should I enter there?

When I enter for example /HOME/USER/VTK_PROGRAM this folder is created (after make and make install) that contains a bin/ folder (along with some other folders).

However, in the /HOME/USER/SETUP_FILES/BUILD there is also a bin/ folder created.

My second question is:

2) I now have three folders with files. Which one(s) should I keep in order to have a working program:


Is it possible to merge the b) and c) folders?


If you conclude the installation with make install (or equivalent), only the last one is needed. The idea is that the build directory contains whatever files were created during the build process (including object files from which libraries and binaries are linked). The directory to which you install the application, contains only what is needed for it to run. This however doesn't have to be a subset of the build directory - it may contain some data files which are included in the source tarball but not necessarily copied into the build directory (although the might be).

Generally speaking, what ends up in the destination directory for install is usually what is packaged in regular distribution packages.


To define a variable with cmake, you do


(.. is where you find the CMakeList.txt)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.