mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Merge 0b656495436f57212be8700794a3d5fb14000c5f into 1b96fa13f549387b7549cc89e1a785cf143a1a50
This commit is contained in:
commit
ac40ea7af3
@ -28,15 +28,6 @@ macro(fix_default_compiler_settings_)
|
|||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
|
if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
|
||||||
# When Google Test is built as a shared library, it should also use
|
|
||||||
# shared runtime libraries. Otherwise, it may end up with multiple
|
|
||||||
# copies of runtime library data in different modules, resulting in
|
|
||||||
# hard-to-find crashes. When it is built as a static library, it is
|
|
||||||
# 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}}")
|
|
||||||
|
|
||||||
# When using Ninja with Clang, static builds pass -D_DLL on Windows.
|
# When using Ninja with Clang, static builds pass -D_DLL on Windows.
|
||||||
# This is incorrect and should not happen, so we fix that here.
|
# This is incorrect and should not happen, so we fix that here.
|
||||||
string(REPLACE "-D_DLL" "" ${flag_var} "${${flag_var}}")
|
string(REPLACE "-D_DLL" "" ${flag_var} "${${flag_var}}")
|
||||||
@ -70,7 +61,19 @@ macro(config_compiler_and_linker)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
fix_default_compiler_settings_()
|
fix_default_compiler_settings_()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
# When Google Test is built as a shared library, it should also use
|
||||||
|
# shared runtime libraries. Otherwise, it may end up with multiple
|
||||||
|
# copies of runtime library data in different modules, resulting in
|
||||||
|
# hard-to-find crashes. When it is built as a static library, it is
|
||||||
|
# preferable to use CRT as static libraries, as we don't have to rely
|
||||||
|
# on CRT DLLs being available. CMake defaults to using shared
|
||||||
|
# CRT libraries, so we change that here.
|
||||||
|
if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Newlines inside flags variables break CMake's NMake generator.
|
# Newlines inside flags variables break CMake's NMake generator.
|
||||||
# TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
|
# TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
|
||||||
set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J")
|
set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user