在 cmake 中使用包括相邻子项目 [英] Use includes of adjacent subproject in cmake
本文介绍了在 cmake 中使用包括相邻子项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发了一个由多个共享库组成的项目,并使用 CMake 构建它.每个库都是通过 add_subdirectory()
构建的.
I develop a project which consisting of several shared libraries and build it with CMake.
Each library is built via add_subdirectory()
.
将第一个库的所有API头添加到第二个的CMakeLists.txt中的最佳方法是什么?
What is the best way to add all the API headers of the fist library to the CMakeLists.txt of the second?
推荐答案
编码目标本身中的包含目录:
Encode the include directories in the target itself:
那个文档是新的,但是 target_include_directories 命令从 CMake 2.8.11 开始就存在了.将其与 INTERFACE 或 PUBLIC 选项一起使用.
That doc is new, but the target_include_directories command exists since CMake 2.8.11. Use it with the INTERFACE or PUBLIC option.
这篇关于在 cmake 中使用包括相邻子项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文