From 9861cdecb1d4592b758c053dffea60f8293bfb4a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 18 Jun 2018 15:26:55 -0400 Subject: [PATCH] Use CMake to automatically set policies to NEW. CMake 3.12 introduces a ... syntax in the version given to cmake_minimum_required to automatically set policies to NEW up to that version. Use it to avoid listing policies explicitly. --- CMake/VTKmConfig.cmake.in | 8 +++++++- CMake/VTKmDeviceAdapters.cmake | 3 ++- CMakeLists.txt | 4 ++-- examples/clipping/CMakeLists.txt | 2 +- examples/contour_tree/CMakeLists.txt | 2 +- examples/cosmotools/CMakeLists.txt | 2 +- examples/demo/CMakeLists.txt | 2 +- examples/game_of_life/CMakeLists.txt | 2 +- examples/hello_world/CMakeLists.txt | 2 +- examples/histogram/CMakeLists.txt | 2 +- examples/isosurface/CMakeLists.txt | 2 +- examples/multi_backend/CMakeLists.txt | 2 +- examples/particle_advection/CMakeLists.txt | 2 +- examples/redistribute_points/CMakeLists.txt | 2 +- examples/rendering/CMakeLists.txt | 2 +- examples/streamline/CMakeLists.txt | 2 +- examples/tau_timing/CMakeLists.txt | 2 +- examples/temporal_advection/CMakeLists.txt | 2 +- examples/tetrahedra/CMakeLists.txt | 2 +- examples/unified_memory/CMakeLists.txt | 2 +- 20 files changed, 28 insertions(+), 21 deletions(-) diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index c274ea448..f214c0252 100644 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -53,7 +53,13 @@ # # -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +if (CMAKE_VERSION VERSION_LESS "3.3") + message(FATAL_ERROR "VTK-m requires CMake 3.3+") +endif() +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND + CMAKE_VERSION VERSION_LESS "3.11") + message(FATAL_ERROR "VTK-m requires CMake 3.11+ when using the Visual Studio Generators") +endif() @PACKAGE_INIT@ diff --git a/CMake/VTKmDeviceAdapters.cmake b/CMake/VTKmDeviceAdapters.cmake index 80fb5fc0d..70657d772 100644 --- a/CMake/VTKmDeviceAdapters.cmake +++ b/CMake/VTKmDeviceAdapters.cmake @@ -48,6 +48,7 @@ if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb) endif() if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm::openmp) + cmake_minimum_required(VERSION 3.9...3.12 FATAL_ERROR) find_package(OpenMP 4.0 REQUIRED COMPONENTS CXX QUIET) add_library(vtkm::openmp INTERFACE IMPORTED GLOBAL) @@ -62,7 +63,7 @@ if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm::openmp) endif() if(VTKm_ENABLE_CUDA AND NOT TARGET vtkm::cuda) - cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + cmake_minimum_required(VERSION 3.9...3.12 FATAL_ERROR) enable_language(CUDA) #To work around https://gitlab.kitware.com/cmake/cmake/issues/17512 diff --git a/CMakeLists.txt b/CMakeLists.txt index c86a58b54..6745f051d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,11 +25,11 @@ # If you want CUDA support, you will need to have CMake 3.9 on Linux/OSX. # We require CMake 3.11 with the MSVC generator as the $ # generator expression is not supported on older versions. -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.3...3.12) project (VTKm) if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - cmake_minimum_required(VERSION 3.11 FATAL_ERROR) + cmake_minimum_required(VERSION 3.11...3.12 FATAL_ERROR) endif() # Update module path diff --git a/examples/clipping/CMakeLists.txt b/examples/clipping/CMakeLists.txt index ae58ec0bc..42b3ae4b9 100644 --- a/examples/clipping/CMakeLists.txt +++ b/examples/clipping/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(Clipping CXX) #Find the VTK-m package diff --git a/examples/contour_tree/CMakeLists.txt b/examples/contour_tree/CMakeLists.txt index 99b9bee67..664655f66 100644 --- a/examples/contour_tree/CMakeLists.txt +++ b/examples/contour_tree/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(ContourTree CXX) #Find the VTK-m package diff --git a/examples/cosmotools/CMakeLists.txt b/examples/cosmotools/CMakeLists.txt index 2cd8683e6..f8b7d6016 100644 --- a/examples/cosmotools/CMakeLists.txt +++ b/examples/cosmotools/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(CosmoTools CXX) #Find the VTK-m package diff --git a/examples/demo/CMakeLists.txt b/examples/demo/CMakeLists.txt index 3a4c05e3d..ec6c08ca6 100644 --- a/examples/demo/CMakeLists.txt +++ b/examples/demo/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(VTKmDemo CXX) #Find the VTK-m package diff --git a/examples/game_of_life/CMakeLists.txt b/examples/game_of_life/CMakeLists.txt index d9dd0e5aa..dd8516454 100644 --- a/examples/game_of_life/CMakeLists.txt +++ b/examples/game_of_life/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(GameOfLife CXX) #Find the VTK-m package diff --git a/examples/hello_world/CMakeLists.txt b/examples/hello_world/CMakeLists.txt index 29dc5f915..24b310e71 100755 --- a/examples/hello_world/CMakeLists.txt +++ b/examples/hello_world/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(HelloWorld CXX) #Find the VTK-m package diff --git a/examples/histogram/CMakeLists.txt b/examples/histogram/CMakeLists.txt index ca6ec1c6c..210b7b331 100644 --- a/examples/histogram/CMakeLists.txt +++ b/examples/histogram/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(Histogram CXX) #Find the VTK-m package diff --git a/examples/isosurface/CMakeLists.txt b/examples/isosurface/CMakeLists.txt index 8bcc08438..096fd8122 100644 --- a/examples/isosurface/CMakeLists.txt +++ b/examples/isosurface/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(IsoSurface CXX) #Find the VTK-m package diff --git a/examples/multi_backend/CMakeLists.txt b/examples/multi_backend/CMakeLists.txt index 86579017f..2132563fa 100644 --- a/examples/multi_backend/CMakeLists.txt +++ b/examples/multi_backend/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(MultiBackend CXX) #Find the VTK-m package diff --git a/examples/particle_advection/CMakeLists.txt b/examples/particle_advection/CMakeLists.txt index 98e8e14a2..b0ebdf452 100644 --- a/examples/particle_advection/CMakeLists.txt +++ b/examples/particle_advection/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(ParticleAdvection CXX) #Find the VTK-m package diff --git a/examples/redistribute_points/CMakeLists.txt b/examples/redistribute_points/CMakeLists.txt index 62700375b..cfc0d67bc 100644 --- a/examples/redistribute_points/CMakeLists.txt +++ b/examples/redistribute_points/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(RedistributePoints CXX) #Find the VTK-m package diff --git a/examples/rendering/CMakeLists.txt b/examples/rendering/CMakeLists.txt index af7be157b..5c735fce7 100644 --- a/examples/rendering/CMakeLists.txt +++ b/examples/rendering/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(RenderingExample CXX) #Find the VTK-m package diff --git a/examples/streamline/CMakeLists.txt b/examples/streamline/CMakeLists.txt index a3c91cb36..959e70786 100644 --- a/examples/streamline/CMakeLists.txt +++ b/examples/streamline/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(Streamline CXX) #Find the VTK-m package diff --git a/examples/tau_timing/CMakeLists.txt b/examples/tau_timing/CMakeLists.txt index abba0c8cf..39e310398 100644 --- a/examples/tau_timing/CMakeLists.txt +++ b/examples/tau_timing/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(TauTiming CXX) #Find the VTK-m package diff --git a/examples/temporal_advection/CMakeLists.txt b/examples/temporal_advection/CMakeLists.txt index b5a1fc9ec..eb607bdfc 100644 --- a/examples/temporal_advection/CMakeLists.txt +++ b/examples/temporal_advection/CMakeLists.txt @@ -21,7 +21,7 @@ ##============================================================================= #Find the VTK-m package -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(TemporalAdvection CXX) #Find the VTK-m package diff --git a/examples/tetrahedra/CMakeLists.txt b/examples/tetrahedra/CMakeLists.txt index 3f0e586f8..1f9d2b17c 100644 --- a/examples/tetrahedra/CMakeLists.txt +++ b/examples/tetrahedra/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(Tetrahedra CXX) #Find the VTK-m package diff --git a/examples/unified_memory/CMakeLists.txt b/examples/unified_memory/CMakeLists.txt index ad14bd3f3..68c4e85c3 100644 --- a/examples/unified_memory/CMakeLists.txt +++ b/examples/unified_memory/CMakeLists.txt @@ -19,7 +19,7 @@ ## this software. ## ##============================================================================= -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR) project(UnifiedMemory CXX) #Find the VTK-m package