
$ make config_print

makefile:90: PATH = /home/fsbuild/git/fs3/packages/anaconda/bin:/home/fsbuild/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 FC=/usr/bin/gfortran-4.8 /usr/bin/cmake -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DPYTHON_EXECUTABLE:FILEPATH=/home/fsbuild/git/fs3/packages/anaconda/bin/python -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DFS_PACKAGES_DIR=/home/fsbuild/git/fs3/packages -DCMAKE_CXX_FLAGS:STRING= -I/usr/include/tcl -Wno-deprecated -Wno-deprecated-declarations -DX11_INCLUDE_DIR=/usr/include/X11 -DOPENGL_glu_LIBRARY=/usr/lib/x86_64-linux-gnu/libGLU.so.1 -DCMAKE_RULE_MESSAGES:BOOL=ON -DINSTALL_PYTHON_DEPENDENCIES:BOOL=OFF -DCMAKE_INSTALL_PREFIX=/home/fsbuild/git/fs3/install -DCMAKE_EXE_LINKER_FLAGS= -Wl,--disable-new-dtags -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lz -DGFORTRAN_LIBRARIES=/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.so -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt5

$ which cmake
/usr/bin/cmake

$ cmake --version
cmake version 3.10.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ ls packages
anaconda  ann  gts  itk  mni  petsc  vtk

$ ls packages/vtk packages/petsc packages/mni packages/itk packages/gts packages/ann packages/anaconda
packages/anaconda:
bin              condabin    envs  include  LICENSE.txt  share  ssl
compiler_compat  conda-meta  etc   lib      pkgs         shell  x86_64-conda_cos6-linux-gnu

packages/ann:
1.1.2

packages/gts:
0.7.6

packages/itk:
4.13.0

packages/mni:
current

packages/petsc:
2.3.3

packages/vtk:
5.10.1

$ make config
makefile:90: PATH = /home/fsbuild/git/fs3/packages/anaconda/bin:/home/fsbuild/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
/usr/bin/make -f makefile config_common
make[1]: Entering directory '/home/fsbuild/git/fs3'
makefile:90: PATH = /home/fsbuild/git/fs3/packages/anaconda/bin:/home/fsbuild/git/fs3/packages/anaconda/bin:/home/fsbuild/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(cd /home/fsbuild/git/fs3/freesurfer && rm -f CMakeCache.txt && rm -f cmake.log)	
(cd /home/fsbuild/git/fs3/freesurfer && CC=/usr/bin/gcc-4.8 CXX=/usr/bin/g++-4.8 FC=/usr/bin/gfortran-4.8 /usr/bin/cmake -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DPYTHON_EXECUTABLE:FILEPATH=/home/fsbuild/git/fs3/packages/anaconda/bin/python -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DFS_PACKAGES_DIR=/home/fsbuild/git/fs3/packages -DCMAKE_CXX_FLAGS:STRING=" -I/usr/include/tcl -Wno-deprecated -Wno-deprecated-declarations" -DX11_INCLUDE_DIR=/usr/include/X11 -DOPENGL_glu_LIBRARY=/usr/lib/x86_64-linux-gnu/libGLU.so.1 -DCMAKE_RULE_MESSAGES:BOOL=ON -DINSTALL_PYTHON_DEPENDENCIES:BOOL=OFF -DCMAKE_INSTALL_PREFIX="/home/fsbuild/git/fs3/install" -DCMAKE_EXE_LINKER_FLAGS=" -Wl,--disable-new-dtags -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lz" -DGFORTRAN_LIBRARIES=/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.so -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt5 -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt5 . 2>&1 | tee -a cmake.log)
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/gcc-4.8
-- Check for working C compiler: /usr/bin/gcc-4.8 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++-4.8
-- Check for working CXX compiler: /usr/bin/g++-4.8 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 4.8.5
-- Check for working Fortran compiler: /usr/bin/gfortran-4.8
-- Check for working Fortran compiler: /usr/bin/gfortran-4.8  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran-4.8 supports Fortran 90
-- Checking whether /usr/bin/gfortran-4.8 supports Fortran 90 -- yes
-- No build type selected - defaulting to Release
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Could NOT find ARMADILLO (missing: ARMADILLO_INCLUDE_DIRS ARMADILLO_LIBRARIES) 
-- Found PETSC: /home/fsbuild/git/fs3/packages/petsc/2.3.3/include  
-- Found ANN: /home/fsbuild/git/fs3/packages/ann/1.1.2/include  
-- Could NOT find GTS (missing: GLIB_CONFIG_INCLUDE_DIR) 
-- Found OpenMP_C: -fopenmp (found version "3.1") 
-- Found OpenMP_CXX: -fopenmp (found version "3.1") 
-- Found OpenMP_Fortran: -fopenmp (found version "3.1") 
-- Found OpenMP: TRUE (found version "3.1")  
-- Found OpenCV: /usr/include  
-- Found X11: /usr/include/X11  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found PythonInterp: /home/fsbuild/git/fs3/packages/anaconda/bin/python (found suitable version "3.7.3", minimum required is "3.5") 
-- Found PythonLibs: /home/fsbuild/git/fs3/packages/anaconda/lib/libpython3.7m.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fsbuild/git/fs3/freesurfer
make[1]: Leaving directory '/home/fsbuild/git/fs3'

... then do

$ make

$ make install

... note that the install pass will likely fail if you have not check out the git annex files

... you may also need to do the following after the install pass succeeds,
# On ubuntu create soft link from freesurfer ./bin to get native qt5 plugin libs,e.g., for freeview 
(cd /home/fsbuild/git/fs3/install/bin && sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms platforms)










