mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-21 15:47:55 +08:00
100 lines
2.9 KiB
Diff
100 lines
2.9 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index d443757..303dfe2 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -102,14 +102,20 @@ IF(MSVC)
|
||
|
ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
|
||
|
ENDIF(MSVC)
|
||
|
|
||
|
+OPTION(ENABLE_STATIC "Enable static builds" OFF)
|
||
|
+IF(ENABLE_STATIC)
|
||
|
+ set(ZIP_EXTERN_OVERRIDE ON)
|
||
|
+ set(ZIP_EXTERN ON)
|
||
|
+ENDIF(ENABLE_STATIC)
|
||
|
+
|
||
|
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
|
||
|
|
||
|
# Targets
|
||
|
ADD_SUBDIRECTORY(lib)
|
||
|
-ADD_SUBDIRECTORY(man)
|
||
|
-ADD_SUBDIRECTORY(src)
|
||
|
-ADD_SUBDIRECTORY(regress)
|
||
|
-ADD_SUBDIRECTORY(examples)
|
||
|
+# ADD_SUBDIRECTORY(man)
|
||
|
+# ADD_SUBDIRECTORY(src)
|
||
|
+# ADD_SUBDIRECTORY(regress)
|
||
|
+# ADD_SUBDIRECTORY(examples)
|
||
|
|
||
|
# TODO: pkgconfig file
|
||
|
|
||
|
diff --git a/cmake-zipconf.h.in b/cmake-zipconf.h.in
|
||
|
index 17edc6c..ac9c394 100644
|
||
|
--- a/cmake-zipconf.h.in
|
||
|
+++ b/cmake-zipconf.h.in
|
||
|
@@ -118,4 +118,10 @@ typedef unsigned long long zip_uint64_t;
|
||
|
#define ZIP_INT64_MAX 0x7fffffffffffffffLL
|
||
|
#define ZIP_UINT64_MAX 0xffffffffffffffffULL
|
||
|
|
||
|
+#cmakedefine ZIP_EXTERN_OVERRIDE
|
||
|
+#ifdef ZIP_EXTERN_OVERRIDE
|
||
|
+#undef ZIP_EXTERN
|
||
|
+#cmakedefine ZIP_EXTERN
|
||
|
+#endif
|
||
|
+
|
||
|
#endif /* zipconf.h */
|
||
|
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||
|
index 1596f30..eb55fc0 100644
|
||
|
--- a/lib/CMakeLists.txt
|
||
|
+++ b/lib/CMakeLists.txt
|
||
|
@@ -191,19 +191,20 @@ IF(NOT HAVE_MKSTEMP)
|
||
|
SET(LIBZIP_EXTRA_FILES mkstemp.c)
|
||
|
ENDIF(NOT HAVE_MKSTEMP)
|
||
|
|
||
|
-ADD_LIBRARY(zip SHARED ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
|
||
|
-SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 3.0 SOVERSION 3 )
|
||
|
-TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY})
|
||
|
-INSTALL(TARGETS zip
|
||
|
- RUNTIME DESTINATION bin
|
||
|
- ARCHIVE DESTINATION lib
|
||
|
- LIBRARY DESTINATION lib)
|
||
|
-#CREATE_LIBTOOL_FILE(zip lib)
|
||
|
-
|
||
|
-#ADD_LIBRARY(zipstatic STATIC ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
|
||
|
-#SET_TARGET_PROPERTIES(zipstatic PROPERTIES VERSION 3.0 SOVERSION 3 )
|
||
|
-#TARGET_LINK_LIBRARIES(zipstatic ${ZLIB_LIBRARY})
|
||
|
-#INSTALL(TARGETS zipstatic
|
||
|
-# RUNTIME DESTINATION bin
|
||
|
-# ARCHIVE DESTINATION lib
|
||
|
-# LIBRARY DESTINATION lib)
|
||
|
+IF(ENABLE_STATIC)
|
||
|
+ ADD_LIBRARY(zipstatic STATIC ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
|
||
|
+ SET_TARGET_PROPERTIES(zipstatic PROPERTIES VERSION 3.0 SOVERSION 3 )
|
||
|
+ TARGET_LINK_LIBRARIES(zipstatic ${ZLIB_LIBRARY})
|
||
|
+ INSTALL(TARGETS zipstatic
|
||
|
+ RUNTIME DESTINATION bin
|
||
|
+ ARCHIVE DESTINATION lib
|
||
|
+ LIBRARY DESTINATION lib)
|
||
|
+ELSE(ENABLE_STATIC)
|
||
|
+ ADD_LIBRARY(zip SHARED ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
|
||
|
+ SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 3.0 SOVERSION 3 )
|
||
|
+ TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY})
|
||
|
+ INSTALL(TARGETS zip
|
||
|
+ RUNTIME DESTINATION bin
|
||
|
+ ARCHIVE DESTINATION lib
|
||
|
+ LIBRARY DESTINATION lib)
|
||
|
+ENDIF(ENABLE_STATIC)
|
||
|
diff --git a/lib/compat.h b/lib/compat.h
|
||
|
index 4c9e3a0..d667fe3 100644
|
||
|
--- a/lib/compat.h
|
||
|
+++ b/lib/compat.h
|
||
|
@@ -42,7 +42,9 @@
|
||
|
#define __STDC_LIMIT_MACROS
|
||
|
|
||
|
#ifdef _WIN32
|
||
|
+#ifndef ZIP_EXTERN_OVERRIDE
|
||
|
#define ZIP_EXTERN __declspec(dllexport)
|
||
|
+#endif
|
||
|
/* for dup(), close(), etc. */
|
||
|
#include <io.h>
|
||
|
#endif
|