Iron-Eagle
Iron-Eagle

Reputation: 1766

static libzip with Visual Studio 2012

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!

Upvotes: 6

Views: 5062

Answers (2)

EvgeniyM
EvgeniyM

Reputation: 11

Ok... here is the deal:

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

...

Correct string for libzip v1.5.1 is:

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

Upvotes: 1

Iron-Eagle
Iron-Eagle

Reputation: 1766

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)

Upvotes: 7

Related Questions