Transitive target_include_directories on OBJECT libraries

后端 未结 4 1296
北恋
北恋 2021-01-01 12:18

Here is snippet from make CMakeLists.txt:

add_library(foo-object OBJECT src/foo.cpp)
target_include_directories(foo-object PUBLIC include)
add_library(foo SH         


        
4条回答
  •  一整个雨季
    2021-01-01 12:35

    It seems that transitive properties only work when targets are linked through a chain of target_link_library calls. In your case, you do not have such a link between foo-object and foo.

    If you add a source file to foo, that one should also not be able to see the include directory from foo-object.

    This might be an oversight in the design of OBJECT libraries, as it essentially breaks the transitive properties for those.

提交回复
热议问题