From bcfad2068e434950a1138b5e195f5e14bffbc0e7 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 1 Sep 2020 08:34:25 -0400 Subject: [PATCH] Put the unbundled Linux executable in a subdirectory (#64992) People frequently assume they can run the executable they find at the top level of the build directory, and don't understand why they get resource errors from the engine. To avoid that, this puts the unbundled copy of the executable in a subdirectory with a name that should warn people away from running it. Fixes #64963 --- .../templates/app/linux.tmpl/CMakeLists.txt.tmpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/flutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl b/packages/flutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl index 7f785aa36a..d0573504e8 100644 --- a/packages/flutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl +++ b/packages/flutter_tools/templates/app/linux.tmpl/CMakeLists.txt.tmpl @@ -45,6 +45,14 @@ apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) # Generated plugin build rules, which manage building the plugins and adding # them to the application.