Loading...
Searching...
No Matches
Installation

Describes how to install the C++ library idol.

idol can be installed using a package manager (recommended) or built from source. Then, to be used from C++, it requires to be linked to your code.

Below, we give several examples on how to do this with the CMake build system.

Installation

Linux (amd64)

Install using apt-get:

echo "deb [arch=amd64 trusted=yes] https://henrilefebvre.com/apt stable main" | sudo tee /etc/apt/sources.list.d/idol.list
sudo apt-get update
sudo apt-get install idol
idol_cl --version

MacOs (arm64)

Install using brew:

brew tap hlefebvr/idol
brew install idol
idol_cl --version

From Source

See the Build from source page.

Linking with idol using CMake

Because idol is built with CMake, integrating it with other CMake projects is very simple.

In your CMakeLists.txt, first look for the idol library by adding

find_package(idol REQUIRED)

Then, assuming your target is called my_target, simply add

target_link_libraries(my_target PUBLIC idol)

That's it! You can now use idol in your C++ project.

Automatic Download using CMake FetchContent

Another possibility to link with idol is to let CMake download it and handle the linkage automatically.

Let's assume that you have a basic CMake project with a CMakeLists.txt that looks like this:

cmake_minimum_required(VERSION 3.23)
project(my_project)
add_executable(my_target main.cpp)

This file creates a target called my_target made of only one source file main.cpp.

Next, let's see how to download idol and link it to your target.

First, we use FetchContent to download idol.

include(FetchContent)
FetchContent_Declare(
idol
GIT_REPOSITORY https://github.com/hlefebvr/idol.git
GIT_TAG origin/main # Here, you can put a specific tag (e.g., v1.0.0) or a commit hash
)
# Ask CMake to download idol and install it to your build directory
FetchContent_MakeAvailable(idol)

Then, we can link idol to our target.

target_link_libraries(my_target PUBLIC idol)

That's it! You can now use idol in your project.

Note that you some CMake options are available and listed on the Build from source page.

These can be set using set(MY_OPTION VALUE). Be sure to check them out!