static libzip with Visual Studio 2012

c++, visual-studio-2012, windows, zip

Solution

Ok... here is the deal:

You need to go to file lib\CMakeLists.txt and add at the end (Line in black)

ADD_LIBRARY(zip SHARED ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES})

ADD_LIBRARY(zipstatic STATIC ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES})

SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 3.0 SOVERSION 3 ) TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY})

INSTALL(TARGETS zip ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)

Problem

I am trying to build a little application using libzip library. I downloaded and compiled libzip with assistance of this article: libzip with Visual Studio 2010 The problem is that it compiles libs dynamically, requiring both zlib.dll and zip.dll to be present. I want to compile the application completely statically, so no additional dlls will be required. does someone know how I can do that? Thanks!

Original source