Transition from GNU Autotools to CMake

One of the new changes GMT5 features is a completely different build system. We switched from the aging GNU autotool build chain (autoconf, configure, automake, libtool, aclocal, ...) to CMake. Autotools, uses shell scripts in the configuration and build process. Hence, it is unsuitable for platforms like Windows which do not support shell scripts on their own. On the other hand, CMake can generate Makefiles for many platforms. It can handle out-of-source builds, ensuring that if a build directory is removed, the source tree remains unaffected and it is able to generate a cache to be used with a graphical editor. In addition, CMake can work with projects that require executables to be created before generating code to be compiled for the final application.

Since GMT5, all builds on all platforms are now performed using CMake. This is an important step to clean up and simplify the GMT build system. The support for GNU autotools has now been removed completely because maintaining two separate build systems simply is too much of a burden. The description of the source build process in the reference manual has been updated to reflect this change. For those who are new to CMake and are familiar with the autotools build process we refer to the excellent Autotools to CMake Transition Guide on the MySQL Forge Wiki. The guide is targeted on MySQL development but provides general information that applies to GMT as well. Find below a list of commands and familiar configure switches and their counterpart and CMake configuration options.

Transition matrix

Previous action Instruction when using CMake
./configure cmake [options] <source-dir>
--prefix -D CMAKE_INSTALL_PREFIX=...
--enable-netcdf -D NETCDF_ROOT=...
--enable-gdal -D GDAL_ROOT=...
--enable-pcre -D PCRE_ROOT=...
--enable-matlab -D MATLAB_ROOT=...
--enable-debug -D CMAKE_BUILD_TYPE=Debug
--enable-US -D UNITS=US
--enable-flock -D FLOCK=ON
--disable-triangle -D LICENSE_RESTRICTED=GPL
CFLAGS -D CMAKE_C_FLAGS=...
guru/gmtguru.macros cmake/ConfigUser.cmake
make manpages make docs_man
make webdocs make docs_html
make pdfdocs make docs_pdf_shrink
make distclean make spotless or rm <build-dir>
make uninstall xargs rm < install_manifest.txt
rm config.cache rm CMakeCache.txt