Repository navigation
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Description
Steps to reproduce:
- Create new Flutter project on Windows
- Go to windows/CMakeLists.txt and replace
set(BINARY_NAME "tesee1")
with
set(APPLICATION_TYPE 0)
add_compile_definitions(IS_EXLOADER=${APPLICATION_TYPE})
if(APPLICATION_TYPE)
set(BINARY_NAME "tesee1")
else()
set(BINARY_NAME "example2")
endif()
- Start application(clean build folder if you've compiled app before)
For some reason flutter creates .exe file with filename example2 but tries to start tesee1

Flutter version: 2.10.2 from stable channel
Reacted by Ricardo Canastro, Luke, Ahmet Enes Bayraktar, Peter Ullrich, Kingkor Roy Tirtho, positive-infinity, Muslimin Ontong, Razvan Lung, Zlati Pehlivanov, Trevin Miller and 19 more
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityplatform-windowsBuilding on or for Windows specificallyBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamOwned by the Windows platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-windowsTriaged by the Windows platform teamTriaged by the Windows platform team
Activity
stuartmorgan-g commentedon Feb 23, 2022
The
fluttertool is just using a simple pattern match to extract the name of the binary to launch; it doesn't know anything about CMake logic. So the changes you have made break the tool's ability to know what the application you are building is called.What are you trying to accomplish here?
krll-kov commentedon Feb 23, 2022
Yet BINARY_NAME is the recommended way of changing the name of the generated binary.
What i'm trying to achieve is one code base with two whole different UI implementations. Just switch one variable in CMake and app will be rendered differently
stuartmorgan-g commentedon Feb 23, 2022
Yes, it is. Specifically, by changing the value (the comment says "Change this line" not "Add arbitrary logic around this line").
The Flutter tool doesn't support all possible changes to the native build files, on any platform. If you change things that Flutter relies on, the tool can't drive it correctly any more.
It sounds like you want flavor support for Windows; updating description accordingly.
[-]Windows CMakeLists.txt BINARY_NAME issue[/-][+]Support flavors for Windows[/+]krll-kov commentedon Feb 23, 2022
I do not know what is flavor, just to avoid unnecessary renames every build i tried to implement dynamic executable name
cybrox commentedon Feb 24, 2023
@Kirill-21 This is exactly what flavors would allow you to do.
They would allow you to specify different names, build settings, icons, etc. depending on the flavor (what you call
APPLICATION_TYPE.On topic: I would really like flavor support on Windows as well. When someone tackles this, it'd be great to have the current flavor exposed to
CMakeListsas a variable or environment variable as well. This would allow adding necessary custom logic to the end of the file so people don't have to mess with the rest.insertjokehere commentedon Aug 29, 2023
This is something I'm very interested in as well. For a first pass, would it make sense to modify the generated CMake config here:
flutter/packages/flutter_tools/lib/src/cmake.dart
Lines 100 to 125 in 6dae269
To set a
FLUTTER_BUILD_FLAVORvariable (using the value passed in by theBuildInfoobject) that could be referenced in the other CMake files to do whatever conditional logic you need for your different flavors. In our case this is picking a different icon, linking in a different resource file, and copying different public keys into the install directory.You'd also need to modify
flutter/packages/flutter_tools/lib/src/commands/build_windows.dart
Lines 21 to 26 in 6dae269
To call
usesFlavorOption()similar to howbuild_appbundle.dartdoes it.I'm happy to spend a bit of time putting together a PR for this, but before I do can someone from the desktop team speak to if a design like this would be acceptable?
4 remaining items
talamaska commentedon Apr 25, 2024
flutter-triage-bot commentedon Jun 6, 2024
Stumblinbear commentedon Jun 17, 2024
12people commentedon Jan 29, 2025
I created a corresponding ticket for Linux, so that all desktop platforms can have equal flavor support.
kjxbyz commentedon Jan 29, 2025
lucavenir commentedon May 4, 2026
Add --flavor support for Windows desktop builds (flutter#187034)
github-actions commentedon Jul 14, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.