Browse Source

MDEV-27813 Windows, compiling : RelWithDebInfo should use /Ob2

Fixed inlining flags. Remove /Ob1 added by CMake for RelWithDebInfo.
(the actual compiler default is /Ob2 if optimizations are enabled)

Allow to define custom /Ob flag with new variable MSVC_INLINE, if desired
pull/2027/head
Vladislav Vaintroub 4 years ago
parent
commit
91d9e9bd80
  1. 12
      cmake/os/Windows.cmake

12
cmake/os/Windows.cmake

@ -169,8 +169,20 @@ IF(MSVC)
IF((NOT "${${flag}}" MATCHES "/Zi") AND (NOT "${${flag}}" MATCHES "/Z7"))
STRING(APPEND ${flag} " /Zi")
ENDIF()
# Remove inlining flags, added by CMake, if any.
# Compiler default is fine.
STRING(REGEX REPLACE "/Ob[0-3]" "" "${flag}" "${${flag}}" )
ENDFOREACH()
# Allow to overwrite the inlining flag
SET(MSVC_INLINE "" CACHE STRING
"MSVC Inlining option, either empty, or one of /Ob0,/Ob1,/Ob2,/Ob3")
IF(MSVC_INLINE MATCHES "/Ob[0-3]")
ADD_COMPILE_OPTIONS(${MSVC_INLINE})
ELSEIF(NOT(MSVC_INLINE STREQUAL ""))
MESSAGE(FATAL_ERROR "Invalid option for MSVC_INLINE")
ENDIF()
IF(WITH_ASAN OR WITH_UBSAN)
# Workaround something Linux specific
SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)

Loading…
Cancel
Save