cmake不设置汇编定义
我正在研究一个使用cmake
构建的项目。我有我的cmake
这样的文件:
dirA/CMakeLists.txt :
add_library(A STATIC ${SRC_FILES})
target_compile_definitions(A public -DABC)
dirB/CMakeLists.txt :
add_library(B STATIC ${SRC_FILES})
target_link_libraries(B PRIVATE A) //-DABC is passed to B
dirC/CMakeLists.txt :
add_library(C STATIC ${SRC_FILES})
target_link_libraries(C B) ////-DABC is not passed to C
我观察到flag -dabc
正在传递给库b
,但没有库c
c
c
b
/代码>。有没有办法在cmake
中传递编译定义?
I am working on a project that use cmake
build. I have my cmake
files like this:
dirA/CMakeLists.txt :
add_library(A STATIC ${SRC_FILES})
target_compile_definitions(A public -DABC)
dirB/CMakeLists.txt :
add_library(B STATIC ${SRC_FILES})
target_link_libraries(B PRIVATE A) //-DABC is passed to B
dirC/CMakeLists.txt :
add_library(C STATIC ${SRC_FILES})
target_link_libraries(C B) ////-DABC is not passed to C
I observe that flag -DABC
is being passed to library B
but not to library C
. Is there a way to pass the compile definitions in cmake
transitively?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。公开链接到B。
私人链接明确停止了属性的传播。
Sure. Link A to B publicly.
Private linkage explicitly halts transitive propagation of properties.