From Blender Developer Wiki
Jump to: navigation, search


This page is intended for advanced CMake usage for developers. If you are looking to get Blender building from source, see Building Blender.

Module Specific CFlags

CMake supports setting flags CMAKE_C_FLAGS & CMAKE_CXX_FLAGS.

This is used globally, since Blender is a large code-base, we've added support for setting flags per target.

For a list of targets:

  • Linux/OSX, run "make help" or "ninja help", depending on the generator you're using.
  • Windows, the list of targets is displayed in MSVC.

Variable names are constructed as follows:


So if for example you want warnings to be errors in BMesh, you can run:

 cmake ../path/to/source -DCMAKE_C_FLAGS_BF_BMESH="-Werror"

And for cycles kernel:

 cmake ../path/to/source -DCMAKE_CXX_FLAGS_CYCLES_KERNEL="-Werror"

These flags will be added to the end of existing cflags.

Reproducible Builds

Blender's release builds use the option WITH_BUILDINFO

This includes build date and time, which means each build will be slightly different from the previous.

Typically you can just disable the WITH_BUILDINFO option, if you don't want this, however projects may want to be able to create reproducible builds. See: To support this we have 2 optional CMake variables:

  • BUILDINFO_OVERRIDE_DATE, formatted YYYY-MM-DD (year:month:day). eg "2016-07-11"
  • BUILDINFO_OVERRIDE_TIME, formatted HH:MM:SS (hour:min:seconds). eg "23:54:05"

When defined, these will override the current date and time.