diff options
-rw-r--r-- | cmake/os/Windows.cmake | 29 | ||||
-rw-r--r-- | win/packaging/CPackWixConfig.cmake | 3 | ||||
-rw-r--r-- | win/upgrade_wizard/CMakeLists.txt | 11 |
3 files changed, 30 insertions, 13 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 67108132d8a..38f440d251d 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -63,6 +63,26 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() IF(MSVC) + SET(MSVC_CRT_TYPE /MT CACHE STRING + "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" + ) + SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) + IF (NOT ";${VALID_CRT_TYPES};" MATCHES ";${MSVC_CRT_TYPE};") + MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ") + ENDIF() + + IF(MSVC_CRT_TYPE MATCHES "/MD") + # Dynamic runtime (DLLs), need to install CRT libraries. + SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)# upgrade wizard + SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) + SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE) + SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) + IF(MSVC_CRT_TYPE STREQUAL "/MDd") + SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE) + ENDIF() + INCLUDE(InstallRequiredSystemLibraries) + ENDIF() + # Enable debug info also in Release build, # and create PDB to be able to analyze crashes. FOREACH(type EXE SHARED MODULE) @@ -85,7 +105,7 @@ IF(MSVC) CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) - STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") + STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" ) STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") ENDFOREACH() @@ -117,13 +137,6 @@ IF(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099") - IF(CMAKE_SIZEOF_VOID_P MATCHES 8) - # _WIN64 is defined by the compiler itself. - # Yet, we define it here again to work around a bug with Intellisense - # described here: http://tinyurl.com/2cb428. - # Syntax highlighting is important for proper debugger functionality. - ADD_DEFINITIONS("-D_WIN64") - ENDIF() ENDIF() # Always link with socket library diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index a8208de659f..e954110ef19 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -9,7 +9,7 @@ IF(ESSENTIALS) ENDIF() ELSE() SET(CPACK_COMPONENTS_USED - "Server;Client;Development;SharedLibraries;Documentation;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine") + "Server;Client;Development;SharedLibraries;Documentation;Readme;Debuginfo;Common;VCCRT;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine") ENDIF() SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") @@ -35,6 +35,7 @@ SET(CPACK_COMPONENTS_ALL ${CPACK_ALL}) SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1) SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall") SET(CPACK_COMPONENT_COMMON_GROUP "AlwaysInstall") +SET(CPACK_COMPONENT_VCCRT_GROUP "AlwaysInstall") # Feature MySQL Server SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MariaDB Server") diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt index 44d6249ea1e..dc4ef67387d 100644 --- a/win/upgrade_wizard/CMakeLists.txt +++ b/win/upgrade_wizard/CMakeLists.txt @@ -16,10 +16,13 @@ IF(NOT MFC_FOUND) ENDIF() RETURN() ENDIF() - -# MFC should be statically linked -SET(CMAKE_MFC_FLAG 1) - +IF(MSVC_CRT_TYPE MATCHES "/MD") + # MFC should be dynamically linked + SET(CMAKE_MFC_FLAG 2) +ELSE() + # MFC should be statically linked + SET(CMAKE_MFC_FLAG 1) +ENDIF() # Enable exception handling (avoids warnings) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") |