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

Fix debian "libatomic not found" error in downstream builds #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ if ("Bin" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
endif()

if ("Lib" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
# Setting FOUND_LIBATOMIC is needed on debian & ubuntu systems to work around bug in
# their capnproto packages. See compat_find.cmake for a more complete explanation.
set(FOUND_LIBATOMIC TRUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

As a local fixup, this variable shouldn't pollute the global namespace.

Maybe unset(FOUND_LIBATOMIC) after find_dependency(CapnProto)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

re: #133 (comment)

As a local fixup, this variable shouldn't pollute the global namespace.

Maybe unset(FOUND_LIBATOMIC) after find_dependency(CapnProto)?

You would know more than me, but it seems like that change could make things worse. If we just unset the variable, wouldn't that just be overwriting it as unset instead of true and polluting the namespace in a different way?

I think you are right that there may be a less invasive way to work around the debian bug though. Maybe checking to see if the variable is set before setting it, and restoring the previous value after finding capnproto. I would have to refresh my memory of cmake variable scopes before doing this though, and I would want he other code in compat_find.cmake from #119 to be consistent so both workarounds are identical.

Could be a good followup but I think current change is probably the most direct fix for the current issue.

include(CMakeFindDependencyMacro)
find_dependency(CapnProto)
endif()
Expand Down