I have the following directory structure:
Project
|
|-CMakeLists.txt
Library
|
|-LibProjectA
| |-CMakeLists.txt
| |-src
| |-SomeHeader0.h
|-LibProjectB
| |-CMakeLists.txt
| |-src
| |-SomeHeader1.h
|-LibProjectC
|-CMakeLists.txt
|-src
|-SomeHeader2.h
OpenSourceProject
|
|-CMakeLists.txt
|-src
|-SomeOpenSourceHeader.h
Wherein Project
includes the statically linked library LibProjectA
in the Library
directory. LibProjectA
depends on LibProjectB
. LibProjectB
depends on LibProjectC
. LibProjectA
, LibProjectB
, and LibProjectC
all utilize the OpenSourceProject
and LibProjectC
specifically requires access to SomeOpenSourceHeader.h
.
Whenever I perform an add_subdirectory
on LibProjectC
, I am forced to provide a precise path specifying where SomeOpenSourceHeader.h
is. Even if this is in the CMakeLists.txt
within the top level Project
directory. Is there some way that by merely performing an add_subdirectory
on the CMakeLists.txt
in the OpenSourceProject
, the path can be provided such that files therein can automatically be recognized elsewhere in the code and that the target project doesn't need to have any knowledge about the open source library used at a much lower level.
All libraries are statically linked.