简体   繁体   中英

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!

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)

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})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM