Differences between revisions 1 and 11 (spanning 10 versions)
⇤ ← Revision 1 as of 2018-07-23 14:59:14 →
Size: 22
Editor: AndrewHoopes
Comment:
← Revision 11 as of 2018-08-03 10:13:18 → ⇥
Size: 1452
Editor: AndrewHoopes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= freesurfer cmake = = 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.

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.

CMake (last edited 2021-03-03 01:25:26 by buildqa)