Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 643
Iron-Eagle Avatar asked Apr 02 '13 08:04

Iron-Eagle


People also ask

How do I create a static library in Visual Studio?

To create a static library project in Visual StudioOn the menu bar, choose File > New > Project to open the Create a New Project dialog. At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Library.

What is static library in Visual Studio?

The sample projects in this article were created using Visual Studio 2010. A static library consists of object files that are linked together with an exe file. Object files are the output of compilers of unmanaged code and consists of functions that can only be used by unmanaged code.


1 Answers

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)

like image 109
Iron-Eagle Avatar answered Sep 21 '22 00:09

Iron-Eagle