Description
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.... )