vcpkg/ports/libzip/enable-static.patch

78 lines
2.0 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
2017-11-21 20:40:07 +08:00
index deceb65..1283013 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
2017-11-21 20:40:07 +08:00
@@ -113,6 +113,15 @@ ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS")
ADD_DEFINITIONS("-D_CRT_NONSTDC_NO_DEPRECATE")
ENDIF(MSVC)
+OPTION(ENABLE_STATIC "Enable static builds" OFF)
+IF(ENABLE_STATIC)
2017-11-21 20:40:07 +08:00
+ set(BUILD_SHARED_LIBS OFF)
+ set(ZIP_EXTERN_OVERRIDE ON)
+ set(ZIP_EXTERN ON)
2017-11-21 20:40:07 +08:00
+ELSE(ENABLE_STATIC)
+ set(BUILD_SHARED_LIBS ON)
+ENDIF(ENABLE_STATIC)
+
ADD_DEFINITIONS("-DHAVE_CONFIG_H")
2017-11-21 20:40:07 +08:00
# rpath handling: use rpath in installed binaries
@@ -121,10 +130,10 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# 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)
2017-11-21 20:40:07 +08:00
# pkgconfig file
SET(prefix ${CMAKE_INSTALL_PREFIX})
diff --git a/cmake-config.h.in b/cmake-config.h.in
index 0d1839c..dd450ff 100644
--- a/cmake-config.h.in
+++ b/cmake-config.h.in
@@ -60,7 +60,7 @@
#cmakedefine WORDS_BIGENDIAN
/* END DEFINES */
#define PACKAGE "@PACKAGE@"
-#define VERSION "@VERSION@"
+#define LIBZIP_VERSION "@VERSION@"
2017-11-21 20:40:07 +08:00
#ifndef HAVE_SSIZE_T_LIBZIP
# if SIZE_T_LIBZIP == INT_LIBZIP
diff --git a/cmake-zipconf.h.in b/cmake-zipconf.h.in
2017-11-21 20:40:07 +08:00
index 6a276f6..410c898 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/compat.h b/lib/compat.h
2017-11-21 20:40:07 +08:00
index 625c84e..8943587 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