Opt into CMake policy CMP0135 (#125502)

~Update the windows app template and migration to use `CMP0135` when
cmake version is >= 3.24.~

Update app templates' and examples' CMakeLists.txt to use
`cmake_policy(VERSION`. https://github.com/flutter/packages/pull/3828
should obviate the need for a migration.

Addresses https://github.com/flutter/flutter/issues/116866

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
diff --git a/dev/benchmarks/complex_layout/windows/CMakeLists.txt b/dev/benchmarks/complex_layout/windows/CMakeLists.txt
index d438ed5..e5249ec 100644
--- a/dev/benchmarks/complex_layout/windows/CMakeLists.txt
+++ b/dev/benchmarks/complex_layout/windows/CMakeLists.txt
@@ -12,7 +12,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt b/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt
index 899fe2f..7bcccd0 100644
--- a/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt
+++ b/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt
@@ -3,7 +3,7 @@
 
 set(BINARY_NAME "flutter_gallery")
 
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
 
diff --git a/dev/integration_tests/ui/windows/CMakeLists.txt b/dev/integration_tests/ui/windows/CMakeLists.txt
index 950267e..2c530c1 100644
--- a/dev/integration_tests/ui/windows/CMakeLists.txt
+++ b/dev/integration_tests/ui/windows/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/dev/integration_tests/windows_startup_test/windows/CMakeLists.txt b/dev/integration_tests/windows_startup_test/windows/CMakeLists.txt
index 334308a..04d2abc 100644
--- a/dev/integration_tests/windows_startup_test/windows/CMakeLists.txt
+++ b/dev/integration_tests/windows_startup_test/windows/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/dev/manual_tests/windows/CMakeLists.txt b/dev/manual_tests/windows/CMakeLists.txt
index af381b9..6a0c8e0 100644
--- a/dev/manual_tests/windows/CMakeLists.txt
+++ b/dev/manual_tests/windows/CMakeLists.txt
@@ -3,7 +3,7 @@
 
 set(BINARY_NAME "manual_tests")
 
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
 
diff --git a/examples/api/windows/CMakeLists.txt b/examples/api/windows/CMakeLists.txt
index 56a9a60..8d3590e 100644
--- a/examples/api/windows/CMakeLists.txt
+++ b/examples/api/windows/CMakeLists.txt
@@ -3,7 +3,7 @@
 
 set(BINARY_NAME "dartpad_curve2_d_0")
 
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
 
diff --git a/examples/flutter_view/windows/CMakeLists.txt b/examples/flutter_view/windows/CMakeLists.txt
index b9fb529..0485fb9 100644
--- a/examples/flutter_view/windows/CMakeLists.txt
+++ b/examples/flutter_view/windows/CMakeLists.txt
@@ -12,7 +12,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/examples/hello_world/windows/CMakeLists.txt b/examples/hello_world/windows/CMakeLists.txt
index 94417c9..51ca9d1 100644
--- a/examples/hello_world/windows/CMakeLists.txt
+++ b/examples/hello_world/windows/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/examples/platform_channel/windows/CMakeLists.txt b/examples/platform_channel/windows/CMakeLists.txt
index a365269..a8a64c8 100644
--- a/examples/platform_channel/windows/CMakeLists.txt
+++ b/examples/platform_channel/windows/CMakeLists.txt
@@ -8,7 +8,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/examples/platform_view/windows/CMakeLists.txt b/examples/platform_view/windows/CMakeLists.txt
index f8a5f5f..36fa4a7 100644
--- a/examples/platform_view/windows/CMakeLists.txt
+++ b/examples/platform_view/windows/CMakeLists.txt
@@ -12,7 +12,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/packages/flutter_tools/templates/app_shared/windows.tmpl/CMakeLists.txt.tmpl b/packages/flutter_tools/templates/app_shared/windows.tmpl/CMakeLists.txt.tmpl
index 5e2a305..78f98b8 100644
--- a/packages/flutter_tools/templates/app_shared/windows.tmpl/CMakeLists.txt.tmpl
+++ b/packages/flutter_tools/templates/app_shared/windows.tmpl/CMakeLists.txt.tmpl
@@ -8,7 +8,7 @@
 
 # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
 # versions of CMake.
-cmake_policy(SET CMP0063 NEW)
+cmake_policy(VERSION 3.14...3.25)
 
 # Define build configuration option.
 get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
diff --git a/packages/flutter_tools/templates/plugin/windows.tmpl/CMakeLists.txt.tmpl b/packages/flutter_tools/templates/plugin/windows.tmpl/CMakeLists.txt.tmpl
index 79f6b75..160ea50 100644
--- a/packages/flutter_tools/templates/plugin/windows.tmpl/CMakeLists.txt.tmpl
+++ b/packages/flutter_tools/templates/plugin/windows.tmpl/CMakeLists.txt.tmpl
@@ -8,6 +8,10 @@
 set(PROJECT_NAME "{{projectName}}")
 project(${PROJECT_NAME} LANGUAGES CXX)
 
+# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
+# versions of CMake.
+cmake_policy(VERSION 3.14...3.25)
+
 # This value is used when generating builds using this plugin, so it must
 # not be changed
 set(PLUGIN_NAME "{{projectName}}_plugin")