CMake is well documented on


Under Windows, CMake comes by default with a GUI. Under Unix system it is quite handy to use the text GUI available through ccmake. ccmake works in the same way than cmake: go in your build directory and

ccmake /path/to/torch/source

Windows and Unix GUI works in the same way: you configure, possibly several times, until CMake has detected everything and proposes to generate the configuration.

After each configuration step, you can modify CMake variables to suit your needs.

CMake variables

CMake is highly configurable thanks to variables you can set when executing it. It is really easy to change these variables with CMake GUI. If you want to stick with the command line you can also change a variable by doing:

cmake /path/to/torch/source -DMY_VARIABLE=MY_VALUE
where MY_VARIABLE is the name of the variable you want to set and MY_VALUE is its corresponding value.

CMake caches everything

As soon as CMake performed a test to detect an external library, it saves the result of this test in a cache and will not test it again.

If you forgot to install a library (like QT or Readline), and install it after having performed a CMake configuration, it will not be used by Torch when compiling.

In doubt, if you changed, updated, added some libraries that should be used by Torch, you should erase your build directory and perform CMake configuration again.

Interesting standard CMake variables

Interesting Torch CMake variables