# The CMake-Based Build System¶

We use CMake for building the SeqAn demos, applications and tests. This wiki page explains our usage of CMake, the variables we define and how to extend the build scripts for new demos, apps etc. CMake’s documentation (v2.8) supplements this document. The documentation of CTest (v2.8) could also be of interest.

## Directory Layout¶

The CMake files live in projects/library/cmake:

$cd projects/library/cmake$ tree
.
|-- CMakeLists.txt
|-- apps
|   -- CMakeLists.txt
|-- demos
|   -- CMakeLists.txt
|-- seqan
|   -- CMakeLists.txt
-- tests
|-- CMakeLists.txt
-- CTestConfig.cmake
`

## Target Structure¶

There is a target for each program to be built.

Additionally, there is a target called Seqan that represents the library. When using the GCC, we need to build the generated forward headers. In this case, Seqan also depends on the generated forward headers and the CMakeList.txt files define how to generate these generated forwards.

## External Dependencies¶

SeqAn is a C++ header library and thus does not need to build itself. However, some applications have dependencies on external libraries, such as Boost or Threading Building Blocks.

The policy is to install these external dependencies on your system and let CMake find them.

The policy for missing dependencies is not to build the programs that depend on them and print an error message.