---
id: android-cmake-integration
title: CMake Integration
slug: /cppsdk/android/cmake-integration/
sidebar_position: 3
custom_edit_url: https://github.com/modio/modio-sdk-internal/blob/develop/platform/android/doc/cmake-integration.mdx
---

# Using inside a CMake project

1 Confirm `your_project` uses CMake 3.20 or later
```cmake
cmake_minimum_required(VERSION 3.20)
```
2 Specify the target platform with ANDROID
```cmake
set (MODIO_PLATFORM ANDROID)
```
3 Add the SDK subdirectory to your project
```cmake
add_subdirectory(<modio-sdk folder> EXCLUDE_FROM_ALL)
target_compile_features(your_project PUBLIC cxx_std_17)
```
4. Link the library to your project
To use the header-only configuration:
```cmake
target_link_libraries(your_project PUBLIC modio)
```
Or to use the static library configuration:

```cmake
target_link_libraries(your_project PUBLIC modioStatic)
```

6. Ensure that you have configured the environment variable `MODIO_NDK_ROOT` to point to your NDK installation directory.

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 Windows SDK. If you copy that file to the folder root, it can be used as follows:

```cmake
cmake --preset android
```

7. There are some resources that must be copied from the mod.io SDK to your own Java application in order to compile and use the SDK. Make sure you include the following somewhere in your CMake scripts.

`platform/android/java/com/modio/modiosdk/` must be copied to your applications `app/src/main/java/com/modio/modiosdk/` directory. The mod.io SDK will automatically load this class for any native interop.

`platform/android/assets/` must be copied to your applications `app/src/main/assets` directory. This includes a signed certificate used for HTTPS requests.
