Template:Building Blender/Linux/cmake

Manual CMake Setup
{{Template:MoreDetails|manual_cmake_setup|Instructions| If you want to have more control over your build configuration or have multiple build directories for a single source directory. You can follow these steps.

Typically useful for developers, who build frequently.

CMake Setup
Now you have to choose a location for CMake build files, currently in-source builds in Blender aren't supported.

Out-of-source build

By doing an "out-of-source" build you create a CMake's directory aside from `~/blender-git/blender`, for example `~/blender-git/build`:

This will generate makefiles in the build directory (`~/blender-git/build`).

Important

As said above, in-source-builds where you build blender from the source code directory are not supported. If CMake finds a `CMakeCache.txt` in the source code directory, it uses that instead of using `~/blender-git/build/CMakeCache.txt`.

If you have tried to do an in-source build, you should remove any CMakeCache.txt from the source code directory before actually running the out-of-source build:

Building Blender
After changes have been done and you have generated the makefiles, you can compile using the make command inside the build directory:

Also notice the install target is used, this will copy scripts and documentation into `~/blender-git/build/bin`

For future builds you can simply update the repository and re-run make. }}

Build Options
By default Blender builds will be similar to official releases. Many Build Options are available for debugging, faster builds, and to enable or disable various features.

System Installation
Portable installation is the default where scripts and data files will be copied into the build `~/blender-git/build/bin` directory and can be moved to other systems easily.

To install Blender into the system directories, a system installation can be used instead. Disable `WITH_INSTALL_PORTABLE` to install into `CMAKE_INSTALL_PREFIX` which uses a typical Unix FHS layout: bin/, share/blender/, man/ etc.