Skip to content

Commit

Permalink
Windows, compiling : Remove _DEBUG preprocessor constant, to fix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vaintroub committed Apr 4, 2017
1 parent fb0b364 commit 15878ee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/os/Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

Expand Down

0 comments on commit 15878ee

Please sign in to comment.