Add a workaround for CMake Policy CMP0148

Without this we start getting errors related to FindSphinx.cmake

I am not sure yet, what version of cmake we can assume in the wild
but the current minimum version supports the old behaviour and this
policy seems relatively recent (CMake version 3.27) so we should
have this workaround till we update our minimum required version.

Fixes https://github.com/ceres-solver/ceres-solver/issues/1002

Change-Id: I1beaac9ee27bc9ff85b64f53f72606a0424f2391
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69f55b4..cedc787 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,16 @@
   cmake_policy(SET CMP0074 NEW)
 endif()
 
+# TODO(sameeragarwal): This should be removed when we go past CMake
+# 3.12 as required as it provides alternate ways of finding the Python
+# interpreter.
+if (POLICY CMP0148)
+  # FindSphinx.cmake uses find_package(PythonInterp 3), which has been deprecated
+  # in cmake 3.27. So use the old behaviour till we update our minimum required
+  # cmake version to 3.27
+  cmake_policy(SET CMP0148 OLD)
+endif()
+
 # On macOS, add the Homebrew prefix (with appropriate suffixes) to the
 # respective HINTS directories (after any user-specified locations).  This
 # handles Homebrew installations into non-standard locations (not /usr/local).