Skip to main content
Version: 1.1.1

CMake工程集成turbo/log

假设 turbo/log 之前是使用 CMake 构建的 或使用包管理器安装,可以使用 CMake 命令 cmake find_package 在 CMake 项目中针对 turbo/log 进行构建,如下所示:

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)

编译的的目标myapp会根据需要,自动将klog添加到依赖中。

或者,可以使用 CMake 命令 cmaketurbo 加入到其中add_subdirectory 直接包含项目子目录中的 turbo 将上一个代码片段中的 cmake find_package 调用替换为add_subdirectory