text 用于构建库和测试套件的有用cmake
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 用于构建库和测试套件的有用cmake相关的知识,希望对你有一定的参考价值。
cmake_minimum_required(VERSION 3.5)
project(Warlock)
add_library(WarlockShared SHARED
src/Warlock.c
)
add_library(WarlockStatic STATIC
src/Warlock.c
)
target_include_directories(WarlockStatic
PUBLIC
${PROJECT_SOURCE_DIR}/include
)
target_include_directories(WarlockShared
PUBLIC
${PROJECT_SOURCE_DIR}/include
)
# Add test executables to build
add_executable(WarlockTests
tests/test.c
)
target_include_directories(WarlockTests
PUBLIC
${PROJECT_SOURCE_DIR}/include
)
# links library to
target_link_libraries( WarlockTests
PRIVATE
WarlockShared
)
以上是关于text 用于构建库和测试套件的有用cmake的主要内容,如果未能解决你的问题,请参考以下文章
iOS 测试目标构建中断,没有为正确的架构构建库
尝试构建库时出现 yaml-cpp 编译器错误
为arm64交叉编译googletest
xcode maven插件无法构建库
CMake ExternalProject_Add() 和 FindPackage()
如何在没有 CMake 的情况下构建 yaml-cpp