From 6e7bf7a21784dfdae0320f67ebabc98d6e3f4011 Mon Sep 17 00:00:00 2001
From: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Date: Sat, 21 Oct 2017 03:48:46 -0400
Subject: [PATCH] STYLE: Add "Display VTK version" section to top-level
 CMakeLists

Note that testing for VTK_BINARY_DIR or Module_WikiExamples are equivalent
since both evaluate to True when building the module from within VTK.


Former-commit-id: 1bee9a59ac8b4d8f71c6e0ee008b69358181df4c
---
 CMakeLists.txt | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5313f90f00..119c16520f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,15 @@ else()
   message(STATUS "${_msg} - no")
 endif()
 
+# Display VTK version
+if(NOT VTK_BINARY_DIR)
+  find_package(VTK REQUIRED)
+endif()
+if(NOT VTK_RENDERING_BACKEND)
+  set(VTK_RENDERING_BACKEND OpenGL) # Support VTK version prior to introduction of rendering backend
+endif()
+message(STATUS "VTKWikiExamples: VTK VERSION: ${VTK_VERSION}(${VTK_RENDERING_BACKEND})")
+
 if(Module_WikiExamples)
   #
   # This is a VTK remote module build
@@ -42,18 +51,10 @@ else()
   # This is a stand-alone build
   #
 
-  # See if VTK is using OpenGL or OpenGL2
-  find_package(VTK CONFIG)
-  if (NOT VTK_RENDERING_BACKEND)
-    set(VTK_RENDERING_BACKEND OpenGL)
-  endif()
-
   find_package(VTK REQUIRED)
   include(${VTK_USE_FILE})
 endif()
 
-message(STATUS "VTKWikiExamples: VTK VERSION: ${VTK_VERSION}(${VTK_RENDERING_BACKEND})")
-
 set(CMAKE_MODULE_PATH ${WikiExamples_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH})
 
 #-----------------------------------------------------------------------------
-- 
GitLab