Skip to content

Installation

Back to index

Previous | Index | Next

MathExpr is a header-only C++ library distributed as a CMake package, and requires a C++20-capable compiler. There are three ways to use it in a project.

Add MathExpr as a dependency fetched at configure time:

include(FetchContent)
FetchContent_Declare(
    MathExpr
    GIT_REPOSITORY https://github.com/sukeya/MathExpr.git
    GIT_TAG        main
)
FetchContent_MakeAvailable(MathExpr)

target_link_libraries(my_target PRIVATE MathExpr)

Direct header inclusion

Copy the include/ directory into your project and add it to the include path. Then include the top-level header:

#include "math_expr.hpp"

Configure and install MathExpr to the system prefix:

cmake -B build
cmake --install build

Then consume it from another CMake project with:

find_package(MathExpr REQUIRED)
target_link_libraries(my_target PRIVATE MathExpr::MathExpr)

Previous | Index | Next