Installing CGAL (Ubuntu)

CGAL version (in existing installations)

To print CGAL version from within your program you can use the following macro defined in the headers of CGAL:

#include <CGAL/version_macros.h>
#include <iostream>

std:cout << CGAL_VERSION_STR << std:endl;

Installing CGAL

Installing an older (stable) version via APT

The easiest way would be via apt or other package manager of your OS. The problem in such approach is that you may not have the latest version of CGAL.

To install via apt for example you can use the following commands:

sudo apt-get install libgmp-dev
sudo apt-get install libmpfr-dev
sudo apt-get install libcgal-dev
sudo apt-get install libcgal-demo

Installing the latest version via DPKG

Install required dependencies:

sudo apt-get install libgmp-dev
sudo apt-get install libmpfr-dev
sudo apt-get install checkinstall

Download the tar file from the official site. Specific instructions are not included in this tutorial since links change rapidly. However, there is a git repository for CGAL with has the releases easily accessible.

After downloading and extracting, run the following commands from that directory:

cmake .
make
sudo checkinstall

Then compile your program with the following libraries (linker arguments):

-lgmp -lmpfr

Exploring files with dpkg

To see where files have been installed you can use dpkg:

dpkg -L cgal

Uninstalling CGAL with DPKG

dpkg -R cgal

References: