diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-30 00:19:28 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2019-06-30 17:48:19 +0200 |
commit | 97c268f864698c42690f2d6832c9e7910f709a72 (patch) | |
tree | a6882a44ac45dbc03bbd48d8f402f92f7a69b127 | |
parent | 0efe50ec358dcb898f5b499a4061953f82d75c4a (diff) | |
download | mariadb-git-97c268f864698c42690f2d6832c9e7910f709a72.tar.gz |
Windows, compiling . various cleanups, use /Zi instead of /Z7
-rw-r--r-- | cmake/os/Windows.cmake | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 6a2657d1a33..9538905a613 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -98,7 +98,7 @@ 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) + 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() @@ -107,6 +107,7 @@ IF(MSVC) SET(DYNAMIC_UCRT_LINKER_OPTION " /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") IF(WITH_ASAN) + SET(MSVC_CRT_TYPE /MD CACHE STRING FORCE) ENABLE_ASAN() ENDIF() @@ -119,19 +120,11 @@ IF(MSVC) "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /debug") ENDFOREACH() - # Force static runtime libraries - # - Choose debugging information: - # /Z7 - # Produces an .obj file containing full symbolic debugging - # information for use with the debugger. The symbolic debugging - # information includes the names and types of variables, as well as - # functions and line numbers. No .pdb file is produced by the compiler. - # - # - Remove preprocessor flag _DEBUG that older cmakes use with Config=Debug, - # it is as defined by Debug runtimes itself (/MTd /MDd) + # Force runtime libraries + # Compile with /Zi to get debugging information FOREACH(lang C CXX) - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") ENDFOREACH() FOREACH(flag CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO @@ -141,10 +134,8 @@ IF(MSVC) CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL ) STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" ) - STRING(REGEX REPLACE "/D[ ]?_DEBUG" "" "${flag}" "${${flag}}") - STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") - IF(NOT "${${flag}}" MATCHES "/Z7") - STRING(APPEND ${flag} " /Z7") + IF(NOT "${${flag}}" MATCHES "/Zi") + STRING(APPEND ${flag} " /Zi") ENDIF() ENDFOREACH() @@ -157,7 +148,6 @@ IF(MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_CL_FLAGS}") ENDIF() - # Fix CMake's predefined huge stack size FOREACH(type EXE SHARED MODULE) STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}") STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") @@ -180,7 +170,7 @@ IF(MSVC) ENDIF() # Speed up multiprocessor build - IF (MSVC_VERSION GREATER 1400 AND (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)) + IF (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") ENDIF() |