Skip to content

Fix find_package cache pollution#20384

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
rogday:find_package_cache
Aug 3, 2021
Merged

Fix find_package cache pollution#20384
opencv-pushbot merged 1 commit intoopencv:masterfrom
rogday:find_package_cache

Conversation

@rogday
Copy link
Copy Markdown
Member

@rogday rogday commented Jul 9, 2021

Find_package sets VTK_DIR to VTK_DIR-NOTFOUND if we didn't find VTK 9, which leads us to not being able to find VTK 8.2 in custom directory as described in #20314.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@rogday rogday changed the title Fix find_package cache pollution [WIP] Fix find_package cache pollution Jul 9, 2021
@rogday rogday changed the title [WIP] Fix find_package cache pollution Fix find_package cache pollution Jul 12, 2021
@@ -1,34 +1,34 @@
# VTK 9.0
if(NOT VTK_FOUND)
find_package(VTK 9 QUIET NAMES vtk COMPONENTS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we save/restore VTK_DIR variable instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It would work, but I think the approach used in this PR better conveys the intent to select appropriate version of a library as opposed to finding any version of a library with required list of components. Besides, saving and restoring VTK_DIR looks like a workaround, whereas the current implementation simply avoids this problem.

@opencv-pushbot opencv-pushbot merged commit da07ad1 into opencv:master Aug 3, 2021
@rogday rogday deleted the find_package_cache branch October 7, 2021 13:15
@alalek alalek mentioned this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants