【发布时间】:2016-12-09 21:02:36
【问题描述】:
正如Google C++ Style Guide 中提到的,项目的所有头文件都应列为项目源目录的后代,而不使用 UNIX 目录快捷方式。 (当前目录)或 ..(父目录)。我该如何在下面简要描述的项目中做到这一点。
我的项目目录层次结构是这样的:
- 图形引擎
- header_files.h
- source_files.cc
- CMakeLists.txt (1)
- 光
- CMakeLists.txt (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)
现在,例如,当我想将 Camera 文件夹中的头文件包含到 Core 文件夹中的文件中时,我必须使用 ../Camera/header_file.h 但我想使用 GraphicsEngine/Camera/header_file.h。我该怎么做?
【问题讨论】: