libiconv provides CMake targets: find_package(Iconv REQUIRED) target_link_libraries(main PRIVATE Iconv::Iconv)