darion-yaphet opened a new pull request, #3391:
URL: https://github.com/apache/brpc/pull/3391
### What problem does this PR solve?
Problem Summary:
Example `CMakeLists.txt` files duplicate the same dependency discovery and
link setup (brpc, protobuf, gflags, leveldb, openssl, thrift, Darwin flags).
That makes
MySQL and other examples hard to maintain and easy to drift.
### What is changed and the side effects?
Changed:
- Add `brpc_example_find_common_deps` in `example/cmake/BrpcExample.cmake`
to centralize common dependency lookup and `DYNAMIC_LIB` construction.
- Migrate MySQL and other example `CMakeLists.txt` files to call the
helper, removing duplicated find/link boilerplate.
- Implement the helper as a CMake `macro` so variables such as
`CMAKE_PREFIX_PATH`, include paths, and library lists propagate to the caller
scope.
- Keep example-specific deps local (e.g. MySQL readline/ncurses/thriftnb,
redis/http gperftools).
Side effects:
- Performance effects: None expected (build-system only).
- Breaking backward compatibility: Low risk. Example CMake entry points
are simplified; users who build examples via each directory's `CMakeLists.txt`
should use
`brpc_example_find_common_deps` / existing `BrpcExample.cmake` helpers
instead of the removed duplicated blocks. `LINK_SO` behavior is preserved.
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]