Skip to content

vcpkg (silently) links wrong libraries #5540

Open
@Neumann-A

Description

@Neumann-A

There are at least two cases where vcpkg (silently) links the wrong libraries:

a) Due to VcpkgAutoLink
related issue: #5485 (comment)

b) Due to CMakeToolchain vcpkg.cmake
cmake find_package links debug libraries instead of release libraries in release mode.
related issue: #4606
I encountered b) while using find_package with LAPACK and OpenBLAS (This one is extremely nasty for consuming packages. Performance of release builds is thus probably bad)

(Issue opened for better search result and hopefully fixing ASAP ;) )

for b) it is probably wise to replace <PackageName>_LIBRARIES with a general generator expression something like:

        if(${${name}_LIBRARIES})
            set(${name}_LIBRARIES_DEBUG ${${name}_LIBRARIES})
            STRING(REPLACE "debug/" "" ${name}_LIBRARIES_RELEASE "${${name}_LIBRARIES}")
            set(${name}_LIBRARIES "$<$<CONFIG:Debug>:${${name}_LIBRARIES_DEBUG}>;$<$<CONFIG:RELEASE>:${${name}_LIBRARIES_RELEASE}>")
        endif()

added to vcpkg.cmake @ 254ff (in the else block of the find_package macro)

(same for _INCLUDES/_INCLUDE_DIR and others.... )

Metadata

Metadata

Assignees

Labels

category:vcpkg-bugThe issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions