diff options
author | kosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2014-01-13 22:24:15 +0000 |
---|---|---|
committer | kosak@google.com <kosak@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2014-01-13 22:24:15 +0000 |
commit | 357070773163979334f922aea127388de17c26fa (patch) | |
tree | ed5e3c915538976af74959e032815c687ef332d4 /cmake | |
parent | bfa2638bc2e88091bb6a4a4496ef10d7f8575553 (diff) | |
download | googletest-357070773163979334f922aea127388de17c26fa.tar.gz |
Make Google Test build cleanly on Visual Studio 2010, 2012, 2013.
Also improve an error message in gtest_test_utils.py.
git-svn-id: http://googletest.googlecode.com/svn/trunk@675 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/internal_utils.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/internal_utils.cmake b/cmake/internal_utils.cmake index 8cb2189..d497ca1 100644 --- a/cmake/internal_utils.cmake +++ b/cmake/internal_utils.cmake @@ -37,7 +37,7 @@ macro(fix_default_compiler_settings_) # 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(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}") endforeach() endif() endmacro() @@ -56,7 +56,7 @@ macro(config_compiler_and_linker) # Newlines inside flags variables break CMake's NMake generator. # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. set(cxx_base_flags "-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi") - if (MSVC_VERSION LESS 1400) + if (MSVC_VERSION LESS 1400) # 1400 is Visual Studio 2005 # Suppress spurious warnings MSVC 7.1 sometimes issues. # Forcing value to bool. set(cxx_base_flags "${cxx_base_flags} -wd4800") @@ -66,6 +66,12 @@ macro(config_compiler_and_linker) # Resolved overload was found by argument-dependent lookup. set(cxx_base_flags "${cxx_base_flags} -wd4675") endif() + if (NOT (MSVC_VERSION LESS 1700)) # 1700 is Visual Studio 2012. + # Suppress "unreachable code" warning on VS 2012 and later. + # http://stackoverflow.com/questions/3232669 explains the issue. + set(cxx_base_flags "${cxx_base_flags} -wd4702") + endif() + set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32") set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN") set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1") |