summaryrefslogtreecommitdiff
path: root/win/upgrade_wizard/CMakeLists.txt
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-10-08 22:48:58 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2018-10-09 08:42:48 +0100
commitf4cdf90d73aeffae37b400fa060bece5917cf4c2 (patch)
treed2b7d5f45dbc8d5a447ef1fab4122b69d7512034 /win/upgrade_wizard/CMakeLists.txt
parentc57bbb259684069e87cbae12c7c04a4284af15c3 (diff)
downloadmariadb-git-f4cdf90d73aeffae37b400fa060bece5917cf4c2.tar.gz
MDEV-17279 Windows : link C runtime dynamically
Changed the build to use /MD flag so that DDL version of C runtime is used. To make sure MariaDB is always runnable on target system, include redistributable CRT libraries into installer. For MSI package, use Microsoft's merge modules. For ZIP use "applocal" approach,i.e place redistributable dlls into the bin directory of the package(via InstallRequiredSystemLibraries cmake module) The space overhead of libraries in negligible, ~ 3MB unpacked. There are 2 cases, where we still link C runtime statically - Upgrade wizard, it uses MFC, and we link statically to avoid redistribute also whole MFC (for this single application, does not make much sense). - MSI installer's custom action dll wixca.dll.Here, we need static link so that MSI won't fail on a target system that does not have VC++2015 runtime already installed.
Diffstat (limited to 'win/upgrade_wizard/CMakeLists.txt')
-rw-r--r--win/upgrade_wizard/CMakeLists.txt18
1 files changed, 12 insertions, 6 deletions
diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt
index f4148ee98d2..7d0e774b968 100644
--- a/win/upgrade_wizard/CMakeLists.txt
+++ b/win/upgrade_wizard/CMakeLists.txt
@@ -23,21 +23,27 @@ IF(NOT MFC_FOUND)
ENDIF()
RETURN()
ENDIF()
+
IF(MSVC_CRT_TYPE MATCHES "/MD")
- # MFC should be dynamically linked
- SET(CMAKE_MFC_FLAG 2)
+ # FORCE static CRT and MFC for upgrade wizard,
+ # so we do not have to redistribute MFC.
+ FORCE_STATIC_CRT()
+ SET(UPGRADE_WIZARD_SOURCES ${CMAKE_SOURCE_DIR}/sql/winservice.c)
ELSE()
- # MFC should be statically linked
- SET(CMAKE_MFC_FLAG 1)
+ SET(UPGRADE_WIZARD_LINK_LIBRARIES winservice)
ENDIF()
+
+# MFC should be statically linked
+SET(CMAKE_MFC_FLAG 1)
+
# Enable exception handling (avoids warnings)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc -DNO_WARN_MBCS_MFC_DEPRECATION")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
MYSQL_ADD_EXECUTABLE(mysql_upgrade_wizard
- upgrade.cpp upgradeDlg.cpp upgrade.rc
+ upgrade.cpp upgradeDlg.cpp upgrade.rc ${UPGRADE_WIZARD_SOURCES}
COMPONENT Server)
-TARGET_LINK_LIBRARIES(mysql_upgrade_wizard winservice)
+TARGET_LINK_LIBRARIES(mysql_upgrade_wizard ${UPGRADE_WIZARD_LINK_LIBRARIES})
# upgrade_wizard is Windows executable, set WIN32_EXECUTABLE so it does not
# create a console.
SET_TARGET_PROPERTIES(mysql_upgrade_wizard PROPERTIES WIN32_EXECUTABLE 1)