Skip to main content

Integrating turbo/log into a CMake Project

Assuming turbo/log was previously built with CMake or installed via a package manager, you can use the CMake command find_package to build against turbo/log in a CMake project, as shown below:

CMakeLists.txt
cmake_minimum_required (VERSION 3.16)
project (myproj VERSION 1.0)

find_package (turbo 0.8.0 REQUIRED)

add_executable (myapp main.cpp)
target_link_libraries (myapp turbo::turbo_static)

The compiled target myapp will automatically add klog to its dependencies as needed.

Alternatively, you can use the CMake command add_subdirectory to include turbo directly from a subdirectory in your project. Replace the find_package call in the previous code snippet with add_subdirectory.