Skip to main content

Installation

GMP is header-only, so installation can be as small as adding the released include/ directory to your compiler's include path. If your project already uses CMake, you can also install GMP once and consume it through find_package.

Use the Released Headers

Download the include archive from the latest release:

Download include.zip

Extract it into your project or a third-party dependency directory, then include the aggregate header:

#include <gmp/gmp.hpp>

This is the simplest setup for trying GMP or vendoring it into an existing codebase.

Install with CMake

Clone, build, and install the project:

git clone https://github.com/lkimuk/gmp.git
cd gmp
cmake -B ./build
cmake --build ./build
cmake --install ./build

Linux and macOS installations may require sudo for the final install step, depending on the chosen install prefix.

Then consume GMP from another CMake project:

find_package(gmp 0.3.0 REQUIRED)
target_link_libraries(your_target PRIVATE gmp::gmp)

Compiler Requirements

The library has two compatibility tiers:

Feature AreaStandard
Macro metaprogrammingC++11 and later
Generic design patternsC++11 and later
Reflection metaprogrammingC++20 and later
Named operatorsC++20 and later

For C++20 features, the recommended minimum compiler versions are:

CompilerMinimum Version
MSVC19.37+
GCC11.1+
Clang18.1.0+