From 96bc743f77c307abb9c07359eae8333ff7324eb6 Mon Sep 17 00:00:00 2001
From: Andrew Maclean <andrew.amaclean@gmail.com>
Date: Sat, 12 Oct 2013 07:33:19 +1100
Subject: [PATCH] ENH: Eliminate CMP0020 warning.

Eliminate a warning when building in Windows that relates
  to static linking of Qt executables to qtmain.lib.
This policy was introduced in CMake version 2.8.11.
CMake version 2.8.11.2 warns when the policy is not set
  and uses OLD behavior.

This change sets the behaviour to NEW as all the Qt
  executables in VTK link to qtmain.lib.

Change-Id: Ie37e447fda1af40c836da56e6c3f5d5c6ce2b4a1
Signed-off-by: Andrew Maclean <andrew.amaclean@gmail.com>
---
 CMakeLists.txt                                | 9 +++++++++
 Examples/GUI/Qt/Events/CMakeLists.txt         | 9 +++++++++
 Examples/GUI/Qt/FourPaneViewer/CMakeLists.txt | 9 +++++++++
 Examples/GUI/Qt/ImageViewer/CMakeLists.txt    | 9 +++++++++
 Examples/GUI/Qt/SimpleView/CMakeLists.txt     | 9 +++++++++
 5 files changed, 45 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c810d36017..d7b60ea40fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,15 @@ if(POLICY CMP0022)
   cmake_policy(SET CMP0022 NEW)
 endif()
 
+# Eliminate a warning when building in Windows that relates
+# to static linking of Qt executables to qtmain.lib.
+# This policy was introduced in CMake version 2.8.11.
+# CMake version 2.8.11.2 warns when the policy is not set
+# and uses OLD behavior.
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 NEW)
+endif()
+
 project(VTK)
 
 # Objective-C++ compile flags, future CMake versions might make this obsolete
diff --git a/Examples/GUI/Qt/Events/CMakeLists.txt b/Examples/GUI/Qt/Events/CMakeLists.txt
index 852642d2410..8b59826a44d 100644
--- a/Examples/GUI/Qt/Events/CMakeLists.txt
+++ b/Examples/GUI/Qt/Events/CMakeLists.txt
@@ -1,5 +1,14 @@
 project(QtEvents)
 
+# Eliminate a warning when building in Windows that relates
+# to static linking of Qt executables to qtmain.lib.
+# This policy was introduced in CMake version 2.8.11.
+# CMake version 2.8.11.2 warns when the policy is not set
+# and uses OLD behavior.
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 NEW)
+endif()
+
 if(NOT VTK_BINARY_DIR)
   find_package(VTK)
   if(NOT VTK_DIR)
diff --git a/Examples/GUI/Qt/FourPaneViewer/CMakeLists.txt b/Examples/GUI/Qt/FourPaneViewer/CMakeLists.txt
index 5460043828e..2383eb9dde4 100644
--- a/Examples/GUI/Qt/FourPaneViewer/CMakeLists.txt
+++ b/Examples/GUI/Qt/FourPaneViewer/CMakeLists.txt
@@ -2,6 +2,15 @@ cmake_minimum_required(VERSION 2.6)
 
 project(QtVTKRenderWindows)
 
+# Eliminate a warning when building in Windows that relates
+# to static linking of Qt executables to qtmain.lib.
+# This policy was introduced in CMake version 2.8.11.
+# CMake version 2.8.11.2 warns when the policy is not set
+# and uses OLD behavior.
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 NEW)
+endif()
+
 if(NOT VTK_BINARY_DIR)
   find_package(VTK)
   if(NOT VTK_DIR)
diff --git a/Examples/GUI/Qt/ImageViewer/CMakeLists.txt b/Examples/GUI/Qt/ImageViewer/CMakeLists.txt
index 59c4b5b254c..0203a726f81 100644
--- a/Examples/GUI/Qt/ImageViewer/CMakeLists.txt
+++ b/Examples/GUI/Qt/ImageViewer/CMakeLists.txt
@@ -1,5 +1,14 @@
 project(QtImageViewer)
 
+# Eliminate a warning when building in Windows that relates
+# to static linking of Qt executables to qtmain.lib.
+# This policy was introduced in CMake version 2.8.11.
+# CMake version 2.8.11.2 warns when the policy is not set
+# and uses OLD behavior.
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 NEW)
+endif()
+
 if(NOT VTK_BINARY_DIR)
   find_package(VTK)
   if(NOT VTK_DIR)
diff --git a/Examples/GUI/Qt/SimpleView/CMakeLists.txt b/Examples/GUI/Qt/SimpleView/CMakeLists.txt
index 7f8e43c2eac..357e64b7953 100644
--- a/Examples/GUI/Qt/SimpleView/CMakeLists.txt
+++ b/Examples/GUI/Qt/SimpleView/CMakeLists.txt
@@ -1,5 +1,14 @@
 project(SimpleView)
 
+# Eliminate a warning when building in Windows that relates
+# to static linking of Qt executables to qtmain.lib.
+# This policy was introduced in CMake version 2.8.11.
+# CMake version 2.8.11.2 warns when the policy is not set
+# and uses OLD behavior.
+if(POLICY CMP0020)
+  cmake_policy(SET CMP0020 NEW)
+endif()
+
 if(NOT VTK_BINARY_DIR)
   find_package(VTK)
   if(NOT VTK_DIR)
-- 
GitLab