Home > Back-end >  vcpkg tiff (libtiff) copies tiffd.dll in debug mode but tries to find tiff.dll
vcpkg tiff (libtiff) copies tiffd.dll in debug mode but tries to find tiff.dll

Time:12-30

I am using Visual Studio 2022 on Windows 11 with vcpkg manifest mode with cmake. I include the "tiff" package, which is libtiff.

When compiling release mode, everything works.

When compiling debug mode, it copies tiffd.dll into the output folder, but when running the app (before it reaches my C main() function), it tries to find tiff.dll and fails with an error message like "tiff.dll not found." Any idea how to resolve this?

This is my vcpkg.json file:

{
    "name": "host",
    "version-string": "0.0",
    "dependencies": [
        "qt5-base",
        "qt5-multimedia",
        "boost-core",
        "boost-container",
        "cereal",
        "cgal",
        "eigen3",
        "tiff",
        "gmp",
        "zlib"
    ]
}

and the only mention I have of "tiff" in the CMakeLists.txt file is:

target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::OpenGL Qt5::Gui Qt5::Multimedia Qt5::Widgets tiff cufft nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc nvjpeg WINMM gmp)

CodePudding user response:

You have to use CMake generator expressions

target_link_libraries(${PROJECT_NAME} PRIVATE
  tiff$<$<CONFIG:Debug>:d>
)

It will link your debug app with the expected tiffd.lib import library.

  • Related