summaryrefslogtreecommitdiff
path: root/cmake/os/Windows.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/os/Windows.cmake')
-rw-r--r--cmake/os/Windows.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index da75c73d585..f951eed7651 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -177,8 +177,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)