[libmariadb]Fix usage error LNK2001.

This commit is contained in:
JackBoosY 2019-08-15 20:20:25 -07:00
parent 22e787f944
commit d72c12c84b
3 changed files with 5 additions and 98 deletions

View File

@ -1,4 +1,4 @@
Source: libmariadb
Version: 3.0.10-3
Version: 3.0.10-4
Homepage: https://github.com/MariaDB/mariadb-connector-c
Description: MariaDB Connector/C is used to connect C/C++ applications to MariaDB and MySQL databases

View File

@ -1,19 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02757a9..b2715dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,11 @@ IF(COMMAND CMAKE_POLICY)
ENDFOREACH()
ENDIF()
+if (BUILD_SHARED_LIBS)
+ set(DEFAULT_LINKAGE DYNAMIC)
+else()
+ set(DEFAULT_LINKAGE STATIC)
+endif()
PROJECT(mariadb-connector-c C)
diff --git a/cmake/install_plugins.cmake b/cmake/install_plugins.cmake
index cd5616c..d058a5c 100644
--- a/cmake/install_plugins.cmake
@ -63,84 +47,3 @@ index a1f039e..03a3a6f 100644
# On Windows, install PDB
INSTALL(FILES $<TARGET_PDB_FILE:libmariadb> DESTINATION "${INSTALL_LIBDIR}"
CONFIGURATIONS Debug RelWithDebInfo
diff --git a/plugins/auth/CMakeLists.txt b/plugins/auth/CMakeLists.txt
index 42f6f05..9a57146 100644
--- a/plugins/auth/CMakeLists.txt
+++ b/plugins/auth/CMakeLists.txt
@@ -14,7 +14,7 @@ REGISTER_PLUGIN(TARGET mysql_native_password
REGISTER_PLUGIN(TARGET dialog
TYPE MARIADB_CLIENT_PLUGIN_AUTH
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${CC_SOURCE_DIR}/plugins/auth/dialog.c
${CC_SOURCE_DIR}/libmariadb/get_password.c)
@@ -33,7 +33,7 @@ IF(WITH_SSL)
REGISTER_PLUGIN(TARGET caching_sha2_password
TYPE MARIADB_CLIENT_PLUGIN_AUTH
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${CC_SOURCE_DIR}/plugins/auth/caching_sha2_pw.c
${CRYPT_SOURCE}
LIBRARIES ${CACHING_SHA2_LIBS})
@@ -53,7 +53,7 @@ IF(GSSAPI_SOURCES)
REGISTER_PLUGIN(TARGET auth_gssapi_client
TYPE MARIADB_CLIENT_PLUGIN_AUTH
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${GSSAPI_SOURCES}
INCLUDES ${CC_SOURCE_DIR}/plugins/auth ${GSSAPI_INCS}
LIBRARIES ${GSSAPI_LIBS})
@@ -68,7 +68,7 @@ IF(${WITH_SSL} STREQUAL "OPENSSL" OR ${WITH_SSL} STREQUAL "SCHANNEL")
REGISTER_PLUGIN(TARGET sha256_password
TYPE MARIADB_CLIENT_PLUGIN_AUTH
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${AUTH_DIR}/sha256_pw.c
LIBRARIES ${SHA256_LIBS})
ENDIF()
@@ -85,6 +85,6 @@ REGISTER_PLUGIN(TARGET mysql_old_password
REGISTER_PLUGIN(TARGET mysql_clear_password
TYPE MARIADB_CLIENT_PLUGIN_AUTH
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${AUTH_DIR}/mariadb_cleartext.c)
diff --git a/plugins/io/CMakeLists.txt b/plugins/io/CMakeLists.txt
index 8c304c9..3547107 100644
--- a/plugins/io/CMakeLists.txt
+++ b/plugins/io/CMakeLists.txt
@@ -7,7 +7,7 @@ IF (WITH_CURL)
REGISTER_PLUGIN(TARGET remote_io
TYPE MARIADB_CLIENT_PLUGIN_IO
CONFIGURATIONS DYNAMIC STATIC OFF
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${CC_SOURCE_DIR}/plugins/io/remote_io.c
INCLUDES ${CURL_INCLUDE_DIR}
LIBRARIES ${CURL_LIBRARIES})
diff --git a/plugins/pvio/CMakeLists.txt b/plugins/pvio/CMakeLists.txt
index 76eb3ef..3601622 100644
--- a/plugins/pvio/CMakeLists.txt
+++ b/plugins/pvio/CMakeLists.txt
@@ -15,13 +15,13 @@ IF(WIN32)
REGISTER_PLUGIN(TARGET pvio_npipe
TYPE MARIADB_CLIENT_PLUGIN_PVIO
CONFIGURATIONS STATIC DYNAMIC DEFAULT
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_npipe.c)
# shared memory
REGISTER_PLUGIN(TARGET pvio_shmem
TYPE MARIADB_CLIENT_PLUGIN_PVIO
CONFIGURATIONS STATIC DYNAMIC DEFAULT
- DEFAULT DYNAMIC
+ DEFAULT ${DEFAULT_LINKAGE}
SOURCES ${CC_SOURCE_DIR}/plugins/pvio/pvio_shmem.c)
ENDIF()

View File

@ -33,6 +33,10 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
if(VCPKG_BUILD_TYPE STREQUAL "debug")
# move headers
file(RENAME