簡體   English   中英

在沒有 CMakeLists.txt 的情況下將目錄添加到 CMake 項目

[英]Add directory to CMake project without CMakeLists.txt

我有以下項目結構:

  • CMakeLists.txt(頂級)
  • 包括
    • 源碼.h
  • 例子
    • CMakeLists.txt
    • 例子.cpp
  • 源代碼
    • CMakeLists.txt
    • 源碼.cpp

頂級CMakeLists.txt包括src和使用add_subdirectoryexamples 我想對include目錄做同樣的事情。 我使用來自include的 header 文件沒有問題。 我想要的是能夠在我的 IDE 中看到include目錄。 目前,如果我用它打開頂級 CMake 文件,QtCreator 不會顯示include目錄。

我知道我可以添加虛擬CMakeLists.txt ,但這有點笨拙。 為了代碼閱讀器的理智,不想這樣做。

在使用add_subdirectory之前,在頂層CMakeLists.txt中添加include_directories(include/)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM