From 04c5efd7514614b3960047637f147a43d44ba7d8 Mon Sep 17 00:00:00 2001 From: Stuart Millman Date: Fri, 1 Dec 2023 15:20:59 +0000 Subject: [PATCH] Fix for cmake policy CMP0148 (#1382) * Fix cmake policy CMP0148 * Fix cmake policy CMP0148 on CMakeLists.txt --- CMakeLists.txt | 6 +++++- cmake/setup_build.cmake | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 075641e4f..7bc8f5d9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,11 @@ if (COMPILER_SUPPORTS_EXTRA_SEMI_WARNING) add_compile_options("-Wextra-semi") endif() -find_host_package(PythonInterp 3 REQUIRED) +if(${CMAKE_VERSION} VERSION_LESS_EQUAL "3.12") + find_package(PythonInterp 3 REQUIRED) +else () + find_package(Python COMPONENTS Interpreter REQUIRED) +endif () if (SHADERC_ENABLE_COPYRIGHT_CHECK) add_custom_target(check-copyright ALL diff --git a/cmake/setup_build.cmake b/cmake/setup_build.cmake index 994de9f11..c5d2a55b4 100644 --- a/cmake/setup_build.cmake +++ b/cmake/setup_build.cmake @@ -49,7 +49,11 @@ if (ANDROID) find_host_package(PythonInterp 3 REQUIRED) find_host_package(BISON) else() -find_package(PythonInterp 3 REQUIRED) + if(${CMAKE_VERSION} VERSION_LESS_EQUAL "3.12") + find_package(PythonInterp 3 REQUIRED) + else () + find_package(Python COMPONENTS Interpreter REQUIRED) + endif () endif() option(DISABLE_RTTI "Disable RTTI in builds")