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 CLion 2021.3 support #4085

Merged
merged 1 commit into from
Oct 20, 2021
Merged

Fix CLion 2021.3 support #4085

merged 1 commit into from
Oct 20, 2021

Conversation

elmot
Copy link
Contributor

@elmot elmot commented Oct 20, 2021

New CMake behavior crashes CLion with apostrophe symbols in add_definitions clause
see https://youtrack.jetbrains.com/issue/CPP-26719

New CMake behavior crashes CLion with apostrophe symbols in `add_definitions` clause
see https://youtrack.jetbrains.com/issue/CPP-26719
@@ -75,7 +75,7 @@ set(CMAKE_CXX_STANDARD {{ cxx_stds[-1] }})

if (CMAKE_BUILD_TYPE MATCHES "{{ env_name }}")
% for define in defines:
add_definitions(-D'{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}}')
add_definitions(-D{{!re.sub(r"([\"\(\)#])", r"\\\1", define)}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use re.escape()
Ex:
add_definitions(-D{{!re.escape(define)}})

@ivankravets
Copy link
Member

@pedrosousabarreto Does add_definitions(-D{{!re.escape(define)}}) work for you?

@pedrosousabarreto
Copy link
Contributor

I can't test it right now, don't have python3.7 on this machine.

A safer approach would be to simply add the space substitution:
add_definitions(-D{{!re.sub(r"([\"\(\)\ #])", r"\\\1", define)}})

@pedrosousabarreto
Copy link
Contributor

pedrosousabarreto commented Nov 9, 2021

@ivankravets Tested and confirmed to work.
Created a PR: https://github.com/elmot/platformio-core/pull/2

@ivankravets
Copy link
Member

@pedrosousabarreto
Copy link
Contributor

@ivankravets Done, see #4105

ivankravets pushed a commit that referenced this pull request Nov 9, 2021
This fix adds spaces to the regex substitutions on CMakeListsPrivate.txt add_definitions.

Fixes #4102
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.

3 participants