From 12243d083a278593a08b7dca32be09e902bbedf6 Mon Sep 17 00:00:00 2001
From: David Neto <dneto@google.com>
Date: Mon, 26 Feb 2018 14:54:16 -0500
Subject: [PATCH] Use DEBUG_POSTFIX instead of CMAKE_DEBUG_POSTFIX

CMAKE_DEBUG_POSTFIX is a global configuration parameter, and
changing it pollutes the configuration space for other projects
that enclose this project.

DEBUG_POSTFIX is better to use since it is a target-specific poperty.

Fixes #1334
Fixes #1268
---
 googletest/CMakeLists.txt             | 2 --
 googletest/cmake/internal_utils.cmake | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index 77b55cae..5c392e2c 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -27,8 +27,6 @@ option(
   "Build gtest with internal symbols hidden in shared libraries."
   OFF)
 
-set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.")
-
 # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
 include(cmake/hermetic_build.cmake OPTIONAL)
 
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 2c978332..01f9fe50 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -158,6 +158,10 @@ function(cxx_library_with_type name type cxx_flags)
   set_target_properties(${name}
     PROPERTIES
     COMPILE_FLAGS "${cxx_flags}")
+  # Generate debug library name with a postfix.
+  set_target_properties(${name}
+    PROPERTIES
+    DEBUG_POSTFIX "d")
   if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
     set_target_properties(${name}
       PROPERTIES