From 5a0739349d1f92dd9209d0d8891e0aa607a0e3ee Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 20 May 2024 14:55:46 -0500 Subject: [PATCH] CMake: No Deprecation Warnings Setting a `cmake_policy` to `OLD` is deprecated by definition and will raise a verbose warning. --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3e941d9f..15ddfc07e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,14 +16,18 @@ endif() # CMake policies ############################################################## # +# Setting a cmake_policy to OLD is deprecated by definition and will raise a +# verbose warning +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) +endif() + # AMReX 21.06+ supports CUDA_ARCHITECTURES with CMake 3.20+ # CMake 3.18+: CMAKE_CUDA_ARCHITECTURES # https://cmake.org/cmake/help/latest/policy/CMP0104.html -#if(CMAKE_VERSION VERSION_LESS 3.20) - if(POLICY CMP0104) - cmake_policy(SET CMP0104 OLD) - endif() -#endif() +if(POLICY CMP0104) + cmake_policy(SET CMP0104 OLD) +endif() # C++ Standard in Superbuilds #################################################