Skip to main content

CMake Integration

Inside a CMake project​

Unzip the archive. Confirm your_project uses CMake 3.20 or later.

cmake_minimum_required(VERSION 3.20)

Specify the target platform with LINUX.

set (MODIO_PLATFORM LINUX)

Add the SDK subdirectory to your project

add_subdirectory(<modio-sdk folder> EXCLUDE_FROM_ALL)
target_compile_features(your_project PUBLIC cxx_std_17)

Link the library to your project.

To use the header-only configuration:

target_link_libraries(your_project PUBLIC modio)

Or to use the static library configuration:

target_link_libraries(your_project PUBLIC modioStatic)

To simplify the CMake configuration, the folder cmake/ has the file CMakePresets.json with the basic configuration required to guide the mod.io SDK compilation using the Linux SDK. If you copy that file to the folder root, it can be used as follows:

cmake --preset linux