= Status Notice = The CMake build configuration is a community-maintained non-officially supported build setup for GEOS. All GEOS users who aim to rely on CMake, please respect Sandro's request stated in comment on ticket #576 : {{{ #!html

*** The official build system is the GNU Automake one. Please only file tickets against CMake if willing to provide a patch. ***

}}} = Building on Unix with CMake = This article describes how to use [http://www.cmake.org CMake] build system to build and install GEOS from sources on Unix-like systems (Linux, Mac OS X, Solaris, *BSD, etc.) using GCC or any other supported compiler. GEOS has got equipped with build configuration for CMake shortly after [milestone:3.2.0 GEOS 3.2.0] release (ticket #317), thus it is considered as work in progress, experimental. Hopefully, it will get into next release of [milestone:3.3.0 GEOS 3.3.0] version. Having CMake installed on Unix-like system, there are two ways of [http://www.cmake.org/cmake/help/runningcmake.html running CMake] to configure and build a software with CMake: * cmake - [http://en.wikipedia.org/wiki/Command-line_interface CLI] program accepting options or running in ''interactive mode'' * ccmake - program with curses-based GUI == Requirements == * [http://www.cmake.org CMake] 2.6 or later * Decent C++ compiler and C++ Standard Library, [http://gcc.gnu.org/ GNU GCC] 4.x or later recommended * GEOS source code. Currently, only source code in SVN [source:trunk trunk] is configured for CMake == Configure == Important, it is highly recommended to configure build out of source code tree. For this purpose, prepare build directory (from now on referred to as ''BUILDDIR''): {{{ $ svn checkout http://svn.osgeo.org/geos/trunk trunk $ mkdir build $ ls build trunk $ cd build $ cmake ../trunk $ make help }}} There is collection of [http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Variables CMake variables] available to set by user to control various aspects of compilation and installation. For instance ''CMAKE_INSTALL_PREFIX'' variable which by default is set to ''/usr/local'' directory. List of CMake options specific to GEOS: * GEOS_ENABLE_TESTS - Set to OFF|ON (default) to control build of GEOS tests package * GEOS_ENABLE_INLINE - Set to OFF|ON (default) to control GEOS compilation with small functions inlining * GEOS_ENABLE_ASSERT - Set to ON|OFF (default) to build GEOS with assert() macro enabled (not available for Visual C++ compiler) * GEOS_ENABLE_MACOSX_FRAMEWORK - Set to ON|OFF (default) to build a Mac OS X framework * GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT - Set to ON|OFF (default) to add compatibility with *nix library linking to the Mac OS X framework Example: {{{ $ cmake ../trunk -DGEOS_ENABLE_TESTS=ON -DGEOS_ENABLE_INLINE=OFF }}} Note: when building a Mac OS X framework, you must specify the CMAKE_INSTALL_PREFIX. The default is /usr/local, and frameworks don't go there. {{{ -DCMAKE_INSTALL_PREFIX=/Library/Frameworks }}} == Build == In order to build GEOS C++ and C libraries, issue the command in ''BUILDDIR'': {{{ $ make }}} == Test == In CMake build system, testing capabilities are provided by [http://www.itk.org/Wiki/CTest:FAQ CTest] which is distributed together with CMake package. After the build is ready, tests can be executed from inside ''BUILDDIR''. Natively, CMake uses target named ''test'': {{{ $ make test }}} For convenience, Autotools-like alias is also available: {{{ $ make check }}} It is also possible to run ''ctest'' program directly, but not through any of the ''make'' targets. This option gives access to number of ''ctest'' command line options (''cmake --help''), for example: {{{ $ ctest $ ctest --verbose }}} == Install == In order to install both C and C++ API libraries as well as headers, stay on in ''BUILDDIR'' and execute: {{{ $ make install }}} == Uninstall == Still in ''BUILDDIR'', run: {{{ $ make uninstall }}} = Open Tickets = [[TicketQuery(status=new|assigned|reopened&component~=cmake&order=priority)]]