From e1ea1dc951a84b2b4d1f91d2dd7b262d92fd6472 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> Date: Sat, 21 Oct 2017 02:50:37 -0400 Subject: [PATCH] STYLE: Refactor top-level CMakeLists into sections and improve reported messages Report message are like the following: ``` -- VTKWikiExamples: Building VTKWikiExamples stand-alone -- VTKWikiExamples: Building VTKWikiExamples stand-alone - yes -- VTKWikiExamples: Setting executables prefix -- VTKWikiExamples: Setting executables prefix - no -- VTKWikiExamples: VTK VERSION: 8.1.0(OpenGL2) [...] ``` or ``` [...] -- VTKWikiExamples: Building VTKWikiExamples stand-alone -- VTKWikiExamples: Building VTKWikiExamples stand-alone - no -- VTKWikiExamples: Setting executables prefix -- VTKWikiExamples: Setting executables prefix - yes [prefix: wiki] [...] ``` Former-commit-id: 33514a73bc7ca4adbef1632a327756f0a0e8ed8b --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a619c0c243..a5313f90f00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,23 +5,49 @@ endif() PROJECT(WikiExamples) -if (Module_WikiExamples) - message(STATUS "VTKWikiExamples: Building VTKWikiExamples as a Remote VTK Module") - message(STATUS "VTKWikiExamples: All executables will have a \"wiki\" prefix") - set(WIKI wiki) +# Display type of build +set(_msg "VTKWikiExamples: Building VTKWikiExamples stand-alone") +message(STATUS "${_msg}") +if(VTK_BINARY_DIR) + message(STATUS "${_msg} - no") +else() + message(STATUS "${_msg} - yes") +endif() + +# Display build properties +set(_msg "VTKWikiExamples: Setting executables prefix") +message(STATUS "${_msg}") +if(VTK_BINARY_DIR) + set(WIKI "wiki") + message(STATUS "${_msg} - yes [prefix: ${WIKI}]") +else() + set(WIKI "") + message(STATUS "${_msg} - no") +endif() + +if(Module_WikiExamples) + # + # This is a VTK remote module build + # + vtk_module_impl() if(NOT EXISTS "${VTK_BINARY_DIR}/VTKConfig.cmake") return() endif() + find_package(VTK PATHS ${VTK_BINARY_DIR}) include(${VTK_USE_FILE}) else() - message(STATUS "VTKWikiExamples: Building VTKWikiExamples stand-alone") -# See if VTK is using OpenGL or OpenGL2 + # + # 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() -- GitLab