Link interface library Iconv:Iconv not found

I’m trying to build my project on macOS. I’m installing pre-reqs using vcpkg.

I’m getting this error:

1> [CMake] CMake Error at out/build/vcpkg_installed/arm64-osx/share/exiv2/exiv2Export.cmake:60 (set_target_properties):
1> [CMake]   The link interface of target "Exiv2::exiv2lib" contains:
1> [CMake] 
1> [CMake]     Iconv::Iconv
1> [CMake] 
1> [CMake]   but the target was not found.

This rather puzzles me as I thought that iconv was shipped with macOS?

What do I need to do to fix this. I don’t use either macports or brew.

I’m using Cmake 3.31.4.

It appears that all I needed was:

if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
find_package(Iconv REQUIRED)
endif()

Or the original maintainer (or vcpkg port author) should have added find_dependency() to that library’s CMake config. That would be a preferred way, but unfortunately it is rather common that they don’t bother/care/aware.