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

CMake projects created with special characters generate uncompilable example #288

Open
jonahgraham opened this issue Feb 16, 2023 · 1 comment
Labels
build Build components of CDT, anything to do with running the compiler, using Make, CMake, or any builder

Comments

@jonahgraham
Copy link
Member

Describe the bug

Using any characters that are not legal for C identifiers in the project names causes compiler errors (except (space) which is handled already).

To Reproduce
Steps to reproduce the behavior:

  1. Create a new C/C++ Project
  2. Choose CMake project (the small Hello World example)
  3. Create a project name with - (dashes) in it
  4. Attempt to build project

For example, call the project example-cmake-project and observe that the config.h.in is invalid C code:

#define example-cmake-project_VERSION_MAJOR @example-cmake-project_VERSION_MAJOR@
#define example-cmake-project_VERSION_MINOR @example-cmake-project_VERSION_MINOR@

PR #105 introduced the config.h.in file and it does have special handling for spaces, but needs it for other characters too:

#define ${projectName?replace(" ", "_")}_VERSION_MAJOR @${projectName?replace(" ", "_")}_VERSION_MAJOR@
#define ${projectName?replace(" ", "_")}_VERSION_MINOR @${projectName?replace(" ", "_")}_VERSION_MINOR@

cc: @mbooth101

@jonahgraham jonahgraham added the build Build components of CDT, anything to do with running the compiler, using Make, CMake, or any builder label Feb 16, 2023
@mbooth101
Copy link
Member

mbooth101 commented Mar 24, 2023

The problem seems more general....

Creating a project called: Cake & ice-cream is 100% perfect, A+++ experience, don't @ me.

It fails at the first non alphanumeric character and results in this error (i.e. the ampersand ruins the XML manifest):

Loading template manifest
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 16; The entity name must immediately follow the '&' in the entity reference.]

Same error occurs for all core build project types (Make/CMake/Meson)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build components of CDT, anything to do with running the compiler, using Make, CMake, or any builder
Projects
None yet
Development

No branches or pull requests

2 participants