[英]Add directory to CMake project without CMakeLists.txt
I have the following project structure:我有以下项目结构:
Top level CMakeLists.txt
includes both src
and examples
using add_subdirectory
.顶级CMakeLists.txt
包括src
和使用add_subdirectory
的examples
。 I want to do the same with include
directory.我想对include
目录做同样的事情。 I have no problem using the header files from include
.我使用来自include
的 header 文件没有问题。 What I want is to be able to see include
directory in my IDE.我想要的是能够在我的 IDE 中看到include
目录。 Currently, QtCreator doesn't show include
directory if I open the top level CMake file with it.目前,如果我用它打开顶级 CMake 文件,QtCreator 不会显示include
目录。
I know that I can add dummy CMakeLists.txt
but that's a bit meh.我知道我可以添加虚拟CMakeLists.txt
,但这有点笨拙。 Don't want to do this for code readers sanity sake.为了代码阅读器的理智,不想这样做。
add include_directories(include/)
in your toplevel CMakeLists.txt
just before using add_subdirectory
在使用add_subdirectory
之前,在顶层CMakeLists.txt
中添加include_directories(include/)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.