CMake is well documented on http://www.cmake.org.
CMake GUI
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_VALUEwhere
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
CMAKE_INSTALL_PREFIX
: directory where Torch is going to be installed
CMAKE_BUILD_TYPE
: Release
for optimized compilation, Debug
for debug compilation.
CMAKE_C_FLAGS
: add here the flags you want to pass to the C compiler (like -Wall
for e.g.)
Interesting Torch CMake variables
HTML_DOC
: set to 1 if you want to generate HTML documentation.
OWN_LUA
: If at 1
, compile our own Lua.
Default value is 1
. It is not recommended to put 0
here, except if you know what you are doing.
If at 0
, CMake will attempt to find Lua on your system (should be in your path).