LibMCP  0.1.5
API to control MCPnet
Including LibMCP

There are three ways to include LibMCP in your project example.

example
├ CMakeLists.txt
└ example.cpp

Option 1: Install LibMCP globally

To achieve this just install LibMCP without providing --prefix. This is the preferred method for Linux. The CMakeLists.txt file can look like this:

# Minimum required CMake version
cmake_minimum_required(VERSION 3.10)
# Create project and add executable target
project(exampleProject VERSION 0.0.1)
add_executable(example example.cpp)
# LibMCP dependency
target_link_libraries(example PRIVATE MCP)

Option 2: Install LibMCP locally

This is the default method for Windows but can also be used on Linux. It's very cumbersome since you need to copy every library file manually or with additional CMake commands.

For including LibMCP with this method you'll need two extra steps before target_link_libraries.

target_include_directories(example PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
find_library(LIB_MCP NAMES MCP PATHS bin)
target_link_libraries(example PRIVATE ${LIB_MCP})

Option 3: Include LibMCP CMake project directly

This is the preferred method on Windows and the easiest way if your project is using CMake. To be able to do this you need to clone LibMCP directly to your project folder.

example
├ CMakeLists.txt
├ example.cpp
└ libmcp
├ CMakeLists.txt
└ ...

The CMakeLists.txt file can look like this:

# Minimum required CMake version
cmake_minimum_required(VERSION 3.10)
# Create project and add executable target
project(exampleProject VERSION 0.0.1)
add_executable(example example.cpp)
# LibMCP dependency
add_subdirectory(libmcp)
target_link_libraries(example PRIVATE MCP)

As pointed out before this method can't be used if you're using a buildsystem other than CMake.