--- libmysql/CMakeLists.txt
+++ libmysql/CMakeLists.txt
@@ -245,7 +245,12 @@
 ADD_SUBDIRECTORY(authentication_ldap)
   
 # Merge several convenience libraries into one big mysqlclient
-MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE} COMPONENT Development)
+SET(EXTRA_ARGS)
+IF(NOT DISABLE_SHARED)
+    SET(EXTRA_ARGS "SKIP_INSTALL")
+ENDIF()
+
+MERGE_CONVENIENCE_LIBRARIES(mysqlclient ${LIBS_TO_MERGE} COMPONENT Development ${EXTRA_ARGS})
 TARGET_LINK_LIBRARIES(mysqlclient PRIVATE ${LIBS_TO_LINK})
 
 # Visual Studio users need debug  static library for debug projects
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -388,7 +388,7 @@
 
 EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
 
-IF(MSVC)
+IF(DISABLE_SHARED)
   GET_TARGET_PROPERTY(LIBMYSQL_OS_SHLIB_VERSION mysqlclient VERSION)
   GET_TARGET_PROPERTY(LIBMYSQL_OS_OUTPUT_NAME mysqlclient OUTPUT_NAME)
 ELSE()
-- 
2.21.1

