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

support with_snappy in cmake #1799

Merged
merged 1 commit into from
Jun 19, 2022
Merged

support with_snappy in cmake #1799

merged 1 commit into from
Jun 19, 2022

Conversation

renzhong
Copy link
Contributor

当 leveldb 依赖 snappy 时,编译 brpc 也需要添加 snappy 相关的 include_path、lib_path 等。
理想状态下应该判断 leveldb 使用了 snappy,才添加 snappy 相关依赖,当实际情况不是很好判断,例如系统中只找到了 libleveldb.a ,没办法通过查找符号的方式判断 libleveldb.so 中是否有 snappy 相关的符号。
因此使用了一种更简单的方式,可以通过 WITH_SNAPPY 来添加相关的依赖。当用户使用默认编译行为编译 brpc,发现 snappy 相关的错误,可以通过 WITH_SNAPPY 快速解决问题。

@wwbmmm
Copy link
Contributor

wwbmmm commented Jun 16, 2022

LGTM

Comment on lines +156 to +157
find_path(SNAPPY_INCLUDE_PATH NAMES snappy.h)
find_library(SNAPPY_LIB NAMES snappy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since snappy provides cmake configuration files SnappyConfig.cmake, we can use find_package instead of this to avoid debug/release mismatched issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to check other libraries too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change this code in: #1812

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

Successfully merging this pull request may close these issues.

None yet

5 participants