-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
AVRO-3088: [C++] Export CMake package config file #3299
base: main
Are you sure you want to change the base?
Conversation
# Boost 1.70 and above provide a BoostConfig.cmake package configuration file. | ||
# It guarantees that Boost::system target exists if found. | ||
# See https://cmake.org/cmake/help/latest/policy/CMP0167.html | ||
find_package (Boost 1.70 REQUIRED CONFIG COMPONENTS system) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't set the Boost version in the Dockerfile
: https://github.com/apache/avro/blob/main/share/docker/Dockerfile#L49
So that's good 👍
lang/c++/CMakeLists.txt
Outdated
endif () | ||
|
||
if (AVRO_BUILD_TESTS) | ||
enable_testing() | ||
|
||
macro (unittest name) | ||
add_executable (${name} test/${name}.cc) | ||
target_link_libraries (${name} avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES}) | ||
target_link_libraries (${name} avrocpp_s Boost::system ZLIB::ZLIB $<$<TARGET_EXISTS:Snappy::snappy>:Snappy::snappy>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use $<TARGET_NAME_IF_EXISTS:Snappy::snappy>
here as well instead of $<$<TARGET_EXISTS:Snappy::snappy>:Snappy::snappy>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's better. I have switched to use TARGET_NAME_IF_EXISTS
. At the same time, the minimum CMake version has been bumped to 3.12 to use it: https://cmake.org/cmake/help/v3.12/release/3.12.html?highlight=target_name_if_exists#generator-expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
What is the purpose of the change
Verifying this change
I have manually verified that the exported config file can be used by downstream projects like below:
Documentation