-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
cmake: Disable discovery of Homebrew libraries for dependencies #11299
base: master
Are you sure you want to change the base?
Conversation
macOS builds should only use dependencies built via the obs-deps build scripts. Default variants of the same dependencies are not compatible with our app packaging requirements and thus will create issues when creating the app bundle. This is specifically an issue when MbedTLS is installed via Homebrew which ships a CMake package config by default and is picked up by our code ever since we switched to prefer CMake packages.
This is still pulling in some homebrew libraries, for example libluajit is still pulled from
I'll see if I can dig into it any more... perhaps /opt/homebrew is still in the |
Can you try with it changed to |
No change with |
From https://cmake.org/cmake/help/latest/variable/CMAKE_IGNORE_PATH.html:
So maybe CMAKE_IGNORE_PATH will work if we explicitly enumerate |
That does make it sound like
|
Hmm, for the prefix path, it also says:
Aren't OBS's CMake finders in the module mode? So |
To me it sounds like the |
To ensure that the find module prefers the variant of LuaJIT shipped as part of obs-deps, it's necessary to give the name as shipped in obs-deps the highest precedence. This ensures that the "find_library" call will discover the less version-specific variant of the library possibly installed via Homebrew.
Per a CMake maintainer, |
It seems like if we exclude all of the following:
Then CMake successfully stops finding any homebrew versions of MbedTLS's config on my system. The extra exclusions seem to be necessary because cmFindPackageCommand::SearchPrefix is appending "/lib/cmake/MbedTLS" to all prefixes for MbedTLS after checking against ignored prefixes, so if |
@@ -36,6 +36,8 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | |||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) | |||
# Use common bundle-relative RPATH for installed targets | |||
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") | |||
# Ignore any dependent packages installed via Homebrew | |||
list(APPEND CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew" "/usr/local/lib") |
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.
list(APPEND CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew" "/usr/local/lib") | |
list(APPEND CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew" "/opt/homebrew/lib" "/usr/local" "/usr/local/lib") |
Per previous comment.
Description
Adds the default installation location of Homebrew packages to list of ignored paths for CMake to resolve dependencies on macOS.
Motivation and Context
macOS builds should only use dependencies built via the obs-deps build scripts. Default variants of the same dependencies are not compatible with our app packaging requirements and thus will create issues when creating the app bundle.
This is specifically an issue when MbedTLS is installed via Homebrew which ships a CMake package config by default and is picked up by our code ever since we switched to prefer CMake packages.
How Has This Been Tested?
Tested on macOS 15 with MbedTLS installed via Homebrew and observed that CMake will only pick up MbedTLS provided by obs-deps.
Types of changes
Checklist: