Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: example app build for Linux (Issue #1667) #1668

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Neer-Pathak
Copy link

Summary

This pull request addresses the issue where the example app in the fl_chart repository fails to build on Linux due to invalid target names in the CMake configuration.

Issue Description

The build process for the Linux platform fails with the following errors:

CMake Error at CMakeLists.txt:63 (add_executable):
  The target name "FL Chart App" is reserved or not valid for certain CMake
  features, such as generator expressions, and may result in undefined
  behavior.

CMake Error at CMakeLists.txt:43 (target_compile_features):
  Cannot specify compile features for target "FL Chart App" which is not
  built by this project.
Call Stack (most recent call first):
  CMakeLists.txt:71 (apply_standard_settings)

CMake Error at CMakeLists.txt:74 (target_link_libraries):
  Cannot specify link libraries for target "FL Chart App" which is not built
  by this project.

Steps to Reproduce

  1. Clone the repository and checkout the main branch.
  2. Run flutter run for the Linux platform.
  3. Observe the build failure with the aforementioned error messages.

Root Cause

The target name "FL Chart App" used in the CMake configuration is invalid for certain CMake features and can lead to undefined behavior. CMake target names should not contain spaces or special characters and should adhere to simple alphanumeric naming conventions.

Solution

The solution involves renaming the target in the CMakeLists.txt file to a valid name. The target name was changed from "FL Chart App" to "fLChartApp".

Changes Made
In CMakeLists.txt:

# Old target name
# set(BINARY_NAME "FL Chart App")

# New valid target name
set(BINARY_NAME "fLChartApp")

Testing

After making this change, the example app successfully builds and runs on Linux.
The new target name adheres to CMake naming conventions and resolves the build issues.

Run flutter clean to clear old build and flutter run again.

fl_chart_linux_app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant