mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-23 08:18:37 -05:00
9ce1b9ef29
This makes
set(CMAKE_BUILD_INTERFACE_INCLUDES ON)
add the equivalent of
set_property(TARGET tgt APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
)
to every target.
If the headers are in CMAKE_CURRENT_SOURCE_DIR, and the generated headers
are in CMAKE_CURRENT_BINARY_DIR, this is a convenient way to build a target
bar, which depends on foo, just by using target_link_libraries() and adding
the INTERFACE_INCLUDE_DIRECTORIES to the INCLUDE_DIRECTORIES of the target
being linked. There will be more-convenient porcelain API to consume the
property in the future.
20 lines
274 B
C++
20 lines
274 B
C++
|
|
#include "depB.h"
|
|
#include "depC.h"
|
|
#include "depIfaceOnly.h"
|
|
|
|
#include "subdirlib.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
DepA a;
|
|
DepB b;
|
|
DepC c;
|
|
|
|
DepIfaceOnly iface_only;
|
|
|
|
SubDirLibObject sd;
|
|
|
|
return a.foo() + b.foo() + c.foo() + iface_only.foo() + sd.foo();
|
|
}
|