FreeSurfer CMake

Configuring a Simple Build

CMake replaces the setup_configure and configure build steps. A build can be initialized in the working directory by running cmake </path/to/repo>. So, assuming you have a freesurfer repository stored in ~/dev/freesurfer, you could set up a simple in-source build with

cd ~/dev/freesurfer
cmake .

or an out-of-source build with

cd ~/dev/fsbuild
cmake ~/dev/freesurfer

Alternatively, ccmake can be used instead of cmake to configure/edit cached variables in a terminal GUI.

Configuration Options

CMake variables are set on the command line with the -D flag. For example, the standard way to configure a build with an install path is

cmake . -DCMAKE_INSTALL_PREFIX="/path/to/install/destination"

You can define any variable on the command line this way, even if the variable is never used in the CMakeLists.txt scripts. Boolean variables added with the option() function can be turned on/off on the command line as well. For example, freesurfer GUI builds can be disabled by running

cmake . -DBUILD_GUIS=OFF

Aside from this initial configuration step (which really only needs to be run once) and fact that make check is now make test, the rest of the build process is pretty much the same.

note: the make output is more condensed now, but make VERBOSE=1 will output everything.