Bug #1266

CMake fails to link zlib with debug config using msvc 2015.

Added by Ben Touchette almost 5 years ago. Updated almost 5 years ago.

Target version:
Start date:
10 Dec 2016
Due date:
13 Dec 2016
% Done:


Estimated time:
10.00 h


Compilation fails for exiv2 and samples when using CMake with MS VS 2015 Community Edition and gives link errors about missing zlib symbols.

CMakeLists.txt is missing the zlib target_link_libraries and fails. Add this line before the expat one in the msvc check fixes the issue:


Adding patch for comments.


Associated revisions

Revision 4696 (diff)
Added by Ben Touchette almost 5 years ago

#1266 Add path to zlib for cmake msvc to src/CMakeList.txt to fix debug buildtype build issues



Updated by Robin Mills almost 5 years ago

  • Category set to build
  • Assignee set to Robin Mills
  • Target version set to 0.26

Your patch looks good. However I'm wondering how you are building Exiv2/CMake/MSVC as the buildserver has successfully built this without the patch!

So my questions is: "What are you doing and why?" If you want to debug code in VS2015, I recommend you keep away from CMake. Open msvc/exiv2.sln. The convertor will take about 5 minutes to run (why is it so slow?). Then build. Set your breakpoints and execute exiv2.exe

I see Daniel has added entries concerning CURL (and SSH) that look suspicious to me. CURL should only be linked when EXIV2_ENABLE_CURL is set.


Updated by Ben Touchette almost 5 years ago

I don't disagree with any of the particulars, except i have a client that uses CMake in their build process and have the support libraries outside the standard paths thus it requires passing them to do CMake during the configuration phase where it finds them but fails on finding the specified path without that patch when building for the debug target during the actual build at which point the linker complains of not find it. Setting the build to release works fine though without the changes.


Updated by Robin Mills almost 5 years ago

  • Status changed from New to Assigned
  • Assignee changed from Robin Mills to Ben Touchette

Well, if your patch is working for you, I am happy. The daily build performed for VS2015 is release/x64 and release/win32. I'll check tomorrow that it hasn't broken.

It's useful that you are working with CMake/MSVC. There may be more pain ahead, however it's only by using those horrors that we can find and fix such mysterious behaviour.

I've assigned this to you. When you're happy, please close this, set the done to 100 and update "estimated time" to account for your effort.


Updated by Ben Touchette almost 5 years ago

I don't think it will be broken, as it worked here. Only the debug version had the issue. I'll take care of updating it tomorrow, having a rather awful morning right now and i think i need to stay away from anything critical, lol, smh.


Updated by Ben Touchette almost 5 years ago

  • Due date set to 13 Dec 2016
  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
  • Estimated time set to 10.00 h


Also available in: Atom PDF