CMake包含路径 [英] CMake include path
本文介绍了CMake包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C ++项目中,我将头文件包含为项目源目录的后代,而不使用UNIX目录快捷方式。要么 .. 。我不知道如何配置cmake工作。
In a C++ project, I would to include the header files as as descendants of the project's source directory without use of UNIX directory shortcuts . or .. . Im not sure how to configure cmake to work with that.
我有目录结构:
Root
|-include
| |- foo.h
|-src
| | foo.cpp
推荐答案
放入root \CMakeList.txt :
put into root\CMakeList.txt:
project(root)
include_directories(${root_SOURCE_DIR}/include)
...
您可以在子项目中的任何位置使用root_SOURCE_DIR。
you can use root_SOURCE_DIR everywhere in sub projects.
了解详情,请访问 http://www.cmake.org/Wiki/CMake_Useful_Variables#Variables_not_listed_here
这篇关于CMake包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文