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

[vcpkg.cmake] Variable scoping bug in vcpkg.cmake find_package override #27498

Closed
Neumann-A opened this issue Oct 27, 2022 · 0 comments · Fixed by #27689
Closed

[vcpkg.cmake] Variable scoping bug in vcpkg.cmake find_package override #27498

Neumann-A opened this issue Oct 27, 2022 · 0 comments · Fixed by #27689
Assignees
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly

Comments

@Neumann-A
Copy link
Contributor

list(APPEND z_vcpkg_find_package_backup_vars "ARGS")
if(DEFINED ARGS)
set(z_vcpkg_find_package_backup_ARGS "${ARGS}")
else()
set(z_vcpkg_find_package_backup_ARGS)
endif()
set(ARGS "${z_vcpkg_find_package_package_name};${z_vcpkg_find_package_ARGN}")

does not correctly restore ARGS for chained/recursive find_package calls. It assumes function scope which doesn't work for find_package since it has to be a macro.

issue observed in #27279:
xcb-wrapper:

 _find_package(X11 COMPONENTS Xau Xdmcp)
_find_package(${ARGS})

The bug above magically transformed ARGS = EXPAT instead XCB for some (not further traced) reason ;)

@Neumann-A Neumann-A changed the title Variable scoping bug in vcpkg.cmake find_package override [vcpkg.cmake] Variable scoping bug in vcpkg.cmake find_package override Oct 27, 2022
@Cheney-W Cheney-W added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly
Projects
None yet
2 participants