-
Notifications
You must be signed in to change notification settings - Fork 501
Update CMakeLists.txt - Check protobuf abseil dependency only when there is no CMAKE_TOOLCHAIN_FILE) #3048
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
Conversation
…ere is no CMAKE_TOOLCHAIN_FILE)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3048 +/- ##
==========================================
+ Coverage 87.12% 87.66% +0.55%
==========================================
Files 200 190 -10
Lines 6109 5866 -243
==========================================
- Hits 5322 5142 -180
+ Misses 787 724 -63 |
You should use |
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0") | ||
if(Protobuf_VERSION | ||
AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0" | ||
AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) |
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.
@owent mentioned, WITH_ABSEIL
is needed even CMAKE_TOOLCHAIN_FILE
is defined (like vcpkg is used).
Does this fix the issue? I think we need more details on it.
@owent @ThomsonTan I think some of the cmake configuration does assume that dependencies are built using the otel-cpp build, and those assumptions shouldn't affect builds using a package manager, imho. |
Sorry, I didn't understand your point. If you use an external protobuf version >= 3.22.0, it must be built with either bundle or external abseil-cpp. We include this check to inform users to enable abseil-cpp when using otel-cpp; otherwise, there may be conflicts in the search paths for some headers. |
@owent You are assuming that abseil headers are actually used (when building otel-cpp when protobuf was externally built (with abseil)). This is not true when building otel-cpp with I the point is to inform users and not fail the build, I'd like the message to have a non-fatal severity. :) |
Protobuf version >= 3.22.0 uses abseil-cpp headers, which conflict with the bundled abseil-cpp headers in otel-cpp located in |
@owent ok, then - as long as it doesn't interfere with WITH_STL. Thank you for patiently explaining :) |
I'm using vcpkg and WITH_STL, and stumbled upon this error when building an updated version. I'm not entirely sure how to solve this properly, but it does look like it is only valid when building the protobuf library itself. Also, in my opinion, the check should not depend on the WITH_ABSEIL option, as this means something different and unrelated to just providing a dependency ("I want to use the absl:: types in the otel-cpp API").
I noticed the NOT DEFINED CMAKE_TOOLCHAIN_FILE elsewhere in CMakeLists.txt, perhaps adding that check is sufficient and meaningful?