summaryrefslogtreecommitdiff
path: root/cmake/os
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-04-04 18:55:18 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2017-04-04 18:55:18 +0000
commit15878ee41c5845403faf16d853011375550f0727 (patch)
treec39e6c8f0c2f65bf3f88733edacbf4ceb90964e7 /cmake/os
parentfb0b3640fe2616f8f3168f8e487bb04f757e3eb1 (diff)
downloadmariadb-git-15878ee41c5845403faf16d853011375550f0727.tar.gz
Windows, compiling : Remove _DEBUG preprocessor constant, to fix
debug build with older cmake. The constant is implicitely defined by VS when chosen C runtime is Debug (/MTd, MDd). CMake does not define it since https://public.kitware.com/Bug/view.php?id=15777 was fixed. We remove it from compile flags, to be able to build Debug with /MT runtime using older cmakes.
Diffstat (limited to 'cmake/os')
-rw-r--r--cmake/os/Windows.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 38f440d251d..22f1ff7f30d 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -97,6 +97,10 @@ IF(MSVC)
# 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)
+
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
ENDFOREACH()
@@ -106,6 +110,7 @@ IF(MSVC)
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" )
+ STRING(REGEX REPLACE "/D[ ]?_DEBUG" "" "${flag}" "${${flag}}")
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
ENDFOREACH()