[I can't find how to properly ask my question to google, so here I am]
My project is roughly organized this way:
Project/
+ Sources/
| + foo1/ # foo1 is a library
| | + bar/
| | + config.in.h
| | + bar.h # includes config.h
| | + bar.cpp # includes bar.h
| + foo2/
| ...
| + foon/
| + Tests/
| + foo1/
| + bar/
| + test-bar.cpp # includes bar.h
+ Build-debug/
+ foo1/bar/config.h # <-- generated from config.h.in
bar.h
includes config.h
which is generated from config.in.h
. And bar.h
is included in bar.cpp
and test-bar.cpp
.
What I'm looking for is a way to specify that all files that depend (i.e. that include directly or indirectly) on bar.h
, which ever directory they are in, shall add ${PROJECT_BINARY_DIR}/foo1/bar
to the included directories when compiled.
So far I've tried variations on
set_property(
SOURCE bar.h
APPEND_STRING
PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
but with no success.
Is what I want to achieve even possible ? And if so, how ?