如在Google C++ Style Guide中提到的那樣,項目的所有頭文件都應該列爲項目源目錄的後代,而不使用UNIX目錄快捷方式。 (當前目錄)或..(父目錄)。我如何在我下面簡要描述的項目中做到這一點。使用cmake創建項目源目錄的後代的頭文件
我的項目目錄層次結構是這樣的:
- GraphicsEngine
- header_files.h
- source_files.cc
- 的CMakeLists.txt(1)
- 光
- CMakeLists.tx T(2)
- header_files.h
- source_files.cc
- 相機
- 的CMakeLists.txt(3)
- header_files.h
- source_files.cc
- 核心
- 的CMakeLists.txt(4)
- header_files.h
- source_files.cc
這些是的CMakeLists.txt文件的內容:
的CMakeLists.txt( 1)
add_library(GraphicsEngineLib source_files.cc)
target_link_libraries(GraphicsEngineLib LightLib CameraLib CoreLib)
add_subdirectory(Light)
add_subdirectory(Camera)
add_subdirectory(Core)
的CMakeLists.txt(2)
add_library(LightLib source_files.cc)
的CMakeLists.txt(3)
add_library(CameraLib source_files.cc)
的CMakeLists.txt(4)
add_library(CoreLib source_files.cc)
現在,當例如我想包括頭文件從相機文件夾到Core文件夾中的文件,我必須使用../Camera/header_file.h,但我想使用GraphicsEngine/Camera/header_file.h。我怎樣才能做到這一點?