Difference between revisions of "CMake Howto"

From ReactOS Wiki
Jump to: navigation, search
Line 22: Line 22:
 
NOTE: This directory will contain a different logical cmake instance.
 
NOTE: This directory will contain a different logical cmake instance.
  
  cmake -G "Unix Makefiles" -DREACTOS_BUILD_TOOLS_DIR:DIR=$TOOLS -DREACTOS_TOOLCHAIN_FILE=toolchain-mingw32.cmake [reactos-dir]
+
  cmake -G "Unix Makefiles" -DREACTOS_BUILD_TOOLS_DIR:DIR=$TOOLS -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake [reactos-dir]
  
 
NOTE: The path to the tools dir *must* be specified as a full path
 
NOTE: The path to the tools dir *must* be specified as a full path

Revision as of 03:51, 9 April 2011

Cmake Crash Course

Understanding cmake

Cmake builds makefiles in the current directory. It leaves a cache file called CMakeCache.txt, even when cmake fails. Always delete this, as command line options don't override what's in there. It's common to bang your head on cmake only to remember that the cache file contains your first mistake.

There are two intermixed cmake instances in reactos, one for host tools and one for reactos itself. ReactOS is built by specifying an alternate toolchain definition for reasons nobody has explained to me. The one for unixen is toolchain-mingw32.cmake and you tell cmake to use it with -DCMAKE_TOOLCHAIN_FILE= .. It'd be nice to name that variable something more understandable.

Makefile emitted by cmake can have VERBOSE=1 specified.

Building tools

make a tools dir somewhere (like ./build/tools)

cmake -G "Unix Makefiles" [reactos-dir]
TOOLS=`pwd`

Building ReactOS

make a different directory (like ./build/ros).

NOTE: This directory will contain a different logical cmake instance.

cmake -G "Unix Makefiles" -DREACTOS_BUILD_TOOLS_DIR:DIR=$TOOLS -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake [reactos-dir]

NOTE: The path to the tools dir *must* be specified as a full path

When cmake fails, errors look like this:

CMake Error at CMakeLists.txt:90 (include):
 include could not find load file:

   ../build/ImportExecutables.cmake

The most common reason for this step to fail is not specifying the path to the tools.