Skip to content

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

@Neumann-A

Description

@Neumann-A

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 ;)

Metadata

Metadata

Assignees

Labels

category:tool-updateThe issue is with build tool or build script, which requires update or should be executed correctly

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions