【发布时间】:2016-07-23 05:38:22
【问题描述】:
我正在使用 CMake 3.5.2。
考虑以下情况。我有一个导入库Foo::Foo:
add_library(Foo::Foo UNKNOWN IMPORTED)
这个导入的库已经填充了适当的属性:
set_target_properties(Foo::Foo PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "/path/to/include/blah" "/another/path/include/other"
IMPORTED_LINK_INTERFACE_LIBRARIES blah other
IMPORTED_LOCATION "/path/to/libfoo.a-or-so")
我有一个名为bar 的便利库。我需要它来包含Foo::Foo 的包含目录,但我不希望它链接到Foo::Foo。
add_library(bar STATIC "${BAR_SOURCES}")
如何仅添加来自Foo::Foo 的包含依赖项?这是我尝试过的失败:
# This did not include any includes from Foo::Foo
target_link_libraries(bar INTERFACE Foo::Foo)
# This included only the first include directory from Foo::Foo
target_include_directories(bar PUBLIC "$<TARGET_PROPERTY:Foo::Foo,INTERFACE_INCLUDE_DIRECTORIES>")
【问题讨论】:
-
你想从上次通话中删除引号吗?
-
@Florian 不,但我只是这样做了,没有任何区别。
标签: cmake