简体   繁体   English

使用Visual Studio 2012的静态libzip

[英]static libzip with Visual Studio 2012

I am trying to build a little application using libzip library. 我正在尝试使用libzip库构建一个小应用程序。 I downloaded and compiled libzip with assistance of this article: 我在本文的帮助下下载并编译了libzip:

libzip with Visual Studio 2010 使用Visual Studio 2010的libzip

The problem is that it compiles libs dynamically, requiring both zlib.dll and zip.dll to be present. 问题是它动态编译库,需要存在zlib.dll和zip.dll。 I want to compile the application completely statically, so no additional dlls will be required. 我想完全静态地编译应用程序,因此不需要额外的dll。 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) 您需要转到文件lib \\ CMakeLists.txt并在末尾添加(黑线)

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

ADD_LIBRARY(zipstatic STATIC ${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}) 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) 安装(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) 您需要转到文件lib \\ CMakeLists.txt并在末尾添加(Line in black)您需要转到文件lib \\ CMakeLists.txt并在末尾添加(Line in black)

... ...

Correct string for libzip v1.5.1 is: libzip v1.5.1的正确字符串是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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