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

opencv: modify CMake config to avoid Cellar paths #208051

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Feb 17, 2025

Homebrew-specific workaround due to our symlink directory structure.

REALPATH would usually be the better option since it avoids other symlink issues (e.g. if you only symlink CMake files and then try to use those, they can end up using incorrect paths if CMAKE_CURRENT_LIST_DIR isn't resolved first).

In Homebrew, for standard layout, this isn't usually not an issue as we symlink all parts of keg. It mainly becomes an issue if using libexec or other non-linked directories.


Specifically to avoid having to patch these up afterwards like in visp:

# Replace generated references to OpenCV's Cellar path
opencv = Formula["opencv"]
opencv_references = Dir[
"CMakeCache.txt",
"CMakeFiles/Export/lib/cmake/visp/VISPModules.cmake",
"VISPConfig.cmake",
"VISPGenerateConfigScript.info.cmake",
"VISPModules.cmake",
"modules/**/flags.make",
"unix-install/VISPConfig.cmake",
]
inreplace opencv_references, opencv.prefix.realpath, opencv.opt_prefix

# Make sure software built against visp don't reference opencv's cellar path either
inreplace [lib/"pkgconfig/visp.pc", lib/"cmake/visp/VISPConfig.cmake", lib/"cmake/visp/VISPModules.cmake"],
opencv.prefix.realpath, opencv.opt_prefix

@github-actions github-actions bot added python Python use is a significant feature of the PR or issue ffmpeg FFMPEG use is a significant feature of the PR or issue labels Feb 17, 2025
@cho-m cho-m marked this pull request as ready for review February 17, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ffmpeg FFMPEG use is a significant feature of the PR or issue python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant