mirror of
https://github.com/google/googletest.git
synced 2026-07-30 16:26:24 +08:00
Handle both -F and /F formats in GoogleTest CMake command lines as MSVC accepts both
This is the legacy fix for https://github.com/google/googletest/issues/4731, and to prevent similar breakages in the future with other flags. The modern fix will be handled separately. PiperOrigin-RevId: 953333662 Change-Id: I7c58b0123170878f0fe6909cabd5decc922b38f1
This commit is contained in:
parent
a503186d79
commit
7ec05f657d
@ -35,21 +35,21 @@ macro(fix_default_compiler_settings_)
|
||||
# preferable to use CRT as static libraries, as we don't have to rely
|
||||
# on CRT DLLs being available. CMake always defaults to using shared
|
||||
# CRT libraries, so we override that default here.
|
||||
string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
|
||||
string(REGEX REPLACE "([/-])MD" "\\1MT" ${flag_var} "${${flag_var}}")
|
||||
|
||||
# When using Ninja with Clang, static builds pass -D_DLL on Windows.
|
||||
# This is incorrect and should not happen, so we fix that here.
|
||||
string(REPLACE "-D_DLL" "" ${flag_var} "${${flag_var}}")
|
||||
string(REGEX REPLACE "([/-])D_DLL" "" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
|
||||
# We prefer more strict warning checking for building Google Test.
|
||||
# Replaces /W3 with /W4 in defaults.
|
||||
string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
|
||||
string(REGEX REPLACE "([/-])W3" "\\1W4" ${flag_var} "${${flag_var}}")
|
||||
|
||||
# Prevent D9025 warning for targets that have exception handling
|
||||
# turned off (/EHs-c- flag). Where required, exceptions are explicitly
|
||||
# re-enabled using the cxx_exception_flags variable.
|
||||
string(REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")
|
||||
string(REGEX REPLACE "([/-])EHsc" "" ${flag_var} "${${flag_var}}")
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user