Skip to content

[dlib] fix LAPACK::LAPACK target not found in dlibConfig.cmake#50979

Draft
Kicer86 wants to merge 1 commit intomicrosoft:masterfrom
Kicer86:dlib_fix
Draft

[dlib] fix LAPACK::LAPACK target not found in dlibConfig.cmake#50979
Kicer86 wants to merge 1 commit intomicrosoft:masterfrom
Kicer86:dlib_fix

Conversation

@Kicer86
Copy link
Copy Markdown
Contributor

@Kicer86 Kicer86 commented Apr 5, 2026

#Fixes #50976

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed.
  • All patch files in the port are applied and succeed.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@Kicer86
Copy link
Copy Markdown
Contributor Author

Kicer86 commented Apr 5, 2026

@microsoft-github-policy-service agree

The fix-dependencies and fix-lapack patches insert find_dependency(BLAS)
and find_dependency(LAPACK) after the include of the targets file
(dlib.cmake) in dlibConfig.cmake. This causes CMake to fail because
LAPACK::LAPACK and BLAS::BLAS are referenced at target load time before
they are defined.

Fix by post-install patching dlibConfig.cmake: move the dependency
resolution before the targets include and add fallback target creation
for BLAS::BLAS and LAPACK::LAPACK.
@Neumann-A
Copy link
Copy Markdown
Contributor

Why is the LAPACK::LAPACK target not found? This looks more like an outdated module and this is not the correct fix.

@dg0yt
Copy link
Copy Markdown
Contributor

dg0yt commented Apr 6, 2026

IMO the actual problem is that find_dependency comes too late. Please test #50984. However I did a little bit more cleanup.

@dg0yt dg0yt mentioned this pull request Apr 6, 2026
Comment on lines +65 to +70
# Workaround: The fix-dependencies and fix-lapack patches insert find_dependency
# calls for BLAS/LAPACK AFTER the include of the targets file (dlib.cmake) in
# dlibConfig.cmake. CMake fails because LAPACK::LAPACK and BLAS::BLAS are
# referenced in dlib.cmake before they are defined.
# Fix: remove the misplaced calls and inject explicit find_package calls (which
# go through the vcpkg cmake wrappers) before the targets include block.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FTR find_dependency() goes through find_package() goes through wrappers. There is no point in layering fragile fixup over poorly maintained patches when we can just fix the patches.

@vicroms
Copy link
Copy Markdown
Member

vicroms commented Apr 8, 2026

@Kicer86 can you test whether this is still necessary now that #50984 has been merged

@vicroms vicroms marked this pull request as draft April 8, 2026 07:29
@Kicer86
Copy link
Copy Markdown
Contributor Author

Kicer86 commented Apr 8, 2026

@Kicer86 can you test whether this is still necessary now that #50984 has been merged

@vicroms
I have added a comment under #50976 that I still have this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dlib] dlibConfig.cmake fails with "LAPACK::LAPACK target not found" — find_dependency calls placed after targets include

4 participants