将目录添加到不带CMakeLists.txt的CMake项目中

问题描述 投票:0回答:1

我具有以下项目结构:

  • CMakeLists.txt(顶层)
  • 包括
    • source.h
  • 示例
    • CMakeLists.txt
    • example.cpp
  • src
    • CMakeLists.txt
    • source.cpp

顶级CMakeLists.txt包括使用srcexamplesadd_subdirectory。我想对include目录执行相同的操作。使用include的头文件没有问题。我想要的是能够在我的IDE中查看include目录。当前,如果我用它打开顶层CMake文件,QtCreator不会显示include目录。

我知道我可以添加虚拟CMakeLists.txt,但是有点麻烦。不想为了代码阅读器的健全性而这样做。

c++ cmake qt-creator
1个回答
0
投票
在使用include_directories(include/)之前将CMakeLists.txt添加到顶级add_subdirectory中>
© www.soinside.com 2019 - 2024. All rights reserved.