-
-
Notifications
You must be signed in to change notification settings - Fork 315
Description
🐛 Bug Report
The Flutter Windows build fails when using flutter_tts because the Windows plugin contains a corrupted CMakeLists.txt file. The build stops with the following error:
CMake Error at flutter/ephemeral/.plugin_symlinks/flutter_tts/windows/CMakeLists.txt:18:
Parse error. Expected "(", got identifier with text "install".
This error occurs even on a fresh Flutter project with the latest Flutter SDK.
✔ Expected Behavior
The plugin should build successfully on Windows without modifying plugin files.
❌ Actual Behavior
The Windows plugin fails due to a malformed NuGet install block in the CMake file. The file contains an invalid extra line:
ARGS install "Microsoft.Windows.CppWinRT" -Version 2.0.210503.1 -ExcludeVersion -OutputDirectory ...
)
This breaks the execute_process() block and causes CMake to throw a parse error.
🔁 Reproduction Steps
-
Create a new Flutter project:
flutter create test_tts cd test_tts -
Add the plugin:
flutter pub add flutter_tts -
Run on Windows:
flutter run -d windows -
Windows build fails with the CMake parse error.
🖥 Platform
- Windows (Error occurs here)
- Android
- iOS
- macOS
⚙ Versions
- flutter_tts: latest from pub.dev
🧩 Root Cause
The plugin’s Windows CMakeLists.txt includes broken CMake syntax:
- Extra
ARGSline outsideexecute_process() - An extra
)that closes nothing - Incorrect NuGet command formatting
This prevents Windows builds from generating plugin build files.
✅ Working Fixed CMakeLists.txt
Here is a clean, working replacement for the plugin’s Windows CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
if(POLICY CMP0153)
cmake_policy(SET CMP0153 NEW)
endif()
set(PROJECT_NAME "flutter_tts")
project(${PROJECT_NAME} LANGUAGES CXX)
find_program(NUGET_EXE NAMES nuget)
if(NOT NUGET_EXE)
message(FATAL_ERROR "nuget.exe not found. Please install it.")
endif()
execute_process(
COMMAND ${NUGET_EXE} install Microsoft.Windows.CppWinRT
-Version 2.0.210503.1
-ExcludeVersion
-OutputDirectory ${CMAKE_BINARY_DIR}/packages
)
set(PLUGIN_NAME "flutter_tts_plugin")
add_library(${PLUGIN_NAME} SHARED
"flutter_tts_plugin.cpp"
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES
)
target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_20)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
target_link_libraries(${PLUGIN_NAME} PRIVATE
flutter
flutter_wrapper_plugin
)
set_target_properties(${PLUGIN_NAME} PROPERTIES VS_PROJECT_IMPORT
"${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.props"
)
target_link_libraries(${PLUGIN_NAME} PRIVATE
"${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.targets"
)
set(flutter_tts_bundled_libraries "" PARENT_SCOPE)🙏 Request
Please update the Windows plugin’s CMakeLists.txt file in the flutter_tts package so Windows builds work without manual patching.
Thanks!