Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于对cmake编译同名静态库和动态库的解释的建议 #12

Open
robin-bird-go opened this issue Aug 3, 2022 · 0 comments
Open

Comments

@robin-bird-go
Copy link

robin-bird-go commented Aug 3, 2022

你好!我在阅读cmake-practice的文档时,有关于编译出hello.so和hello.a的两个库的内容中,涉及到使用
SET_TARGET_PROPERTIES(hello PROPERTIES CLEAN_DIRECT_OUTPUT 1) SET_TARGET_PROPERTIES(hello_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
来防止库因同名而被删除的问题,但是个人(目前使用的cmake是3.10.2)经过一些尝试,在不使用以上语句的情况下也能成功编译出两个同名的库,有没有可能是版本更新后对此进行了优化导致的?或者请问我这样的尝试有什么不当之处吗?还请赐教


ADD_LIBRARY(hello SHARED ${LIBHELLO_SRC})

#[[
SET_TARGET_PROPERTIES(
    hello 
    PROPERTIES 
                CLEAN_DIRECT_OUTPUT 1            
)
]]

ADD_LIBRARY(hello_static STATIC ${LIBHELLO_SRC})

SET_TARGET_PROPERTIES(
    hello_static
    PROPERTIES 
                OUTPUT_NAME "hello"
)

图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant