From 7d37f2a616a31cd60ad5e1d39730def9b0df8205 Mon Sep 17 00:00:00 2001 From: yaakovschectman <109111084+yaakovschectman@users.noreply.github.com> Date: Fri, 28 Apr 2023 17:49:54 -0400 Subject: [PATCH] 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]. [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 --- dev/benchmarks/complex_layout/windows/CMakeLists.txt | 2 +- dev/integration_tests/flutter_gallery/windows/CMakeLists.txt | 2 +- dev/integration_tests/ui/windows/CMakeLists.txt | 2 +- .../windows_startup_test/windows/CMakeLists.txt | 2 +- dev/manual_tests/windows/CMakeLists.txt | 2 +- examples/api/windows/CMakeLists.txt | 2 +- examples/flutter_view/windows/CMakeLists.txt | 2 +- examples/hello_world/windows/CMakeLists.txt | 2 +- examples/platform_channel/windows/CMakeLists.txt | 2 +- examples/platform_view/windows/CMakeLists.txt | 2 +- .../templates/app_shared/windows.tmpl/CMakeLists.txt.tmpl | 2 +- .../templates/plugin/windows.tmpl/CMakeLists.txt.tmpl | 4 ++++ 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dev/benchmarks/complex_layout/windows/CMakeLists.txt b/dev/benchmarks/complex_layout/windows/CMakeLists.txt index d438ed55c4..e5249ec113 100644 --- a/dev/benchmarks/complex_layout/windows/CMakeLists.txt +++ b/dev/benchmarks/complex_layout/windows/CMakeLists.txt @@ -12,7 +12,7 @@ set(BINARY_NAME "complex_layout") # 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 899fe2f7aa..7bcccd0e73 100644 --- a/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt +++ b/dev/integration_tests/flutter_gallery/windows/CMakeLists.txt @@ -3,7 +3,7 @@ project(flutter_gallery LANGUAGES CXX) 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 950267e782..2c530c16f0 100644 --- a/dev/integration_tests/ui/windows/CMakeLists.txt +++ b/dev/integration_tests/ui/windows/CMakeLists.txt @@ -8,7 +8,7 @@ set(BINARY_NAME "ui") # 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 334308a189..04d2abc343 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 @@ set(BINARY_NAME "windows_startup_test") # 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 af381b95f3..6a0c8e0d9b 100644 --- a/dev/manual_tests/windows/CMakeLists.txt +++ b/dev/manual_tests/windows/CMakeLists.txt @@ -3,7 +3,7 @@ project(manual_tests LANGUAGES CXX) 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 56a9a607ca..8d3590ee41 100644 --- a/examples/api/windows/CMakeLists.txt +++ b/examples/api/windows/CMakeLists.txt @@ -3,7 +3,7 @@ project(dartpad_curve2_d_0 LANGUAGES CXX) 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 b9fb5292d1..0485fb94f2 100644 --- a/examples/flutter_view/windows/CMakeLists.txt +++ b/examples/flutter_view/windows/CMakeLists.txt @@ -12,7 +12,7 @@ set(BINARY_NAME "flutter_view") # 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 94417c99a9..51ca9d1db7 100644 --- a/examples/hello_world/windows/CMakeLists.txt +++ b/examples/hello_world/windows/CMakeLists.txt @@ -8,7 +8,7 @@ set(BINARY_NAME "hello_world") # 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 a36526998b..a8a64c8d51 100644 --- a/examples/platform_channel/windows/CMakeLists.txt +++ b/examples/platform_channel/windows/CMakeLists.txt @@ -8,7 +8,7 @@ set(BINARY_NAME "platform_channel") # 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 f8a5f5f6fd..36fa4a7d46 100644 --- a/examples/platform_view/windows/CMakeLists.txt +++ b/examples/platform_view/windows/CMakeLists.txt @@ -12,7 +12,7 @@ set(BINARY_NAME "platform_view") # 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 5e2a3058fa..78f98b83d5 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 @@ set(BINARY_NAME "{{projectName}}") # 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 79f6b75e7a..160ea50f88 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 @@ cmake_minimum_required(VERSION 3.14) 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")