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

Codechange: Make codestyle for CMake files consistent for 'control' statements #8319

Merged
merged 1 commit into from Sep 25, 2020

Conversation

LordAro
Copy link
Member

@LordAro LordAro commented Sep 25, 2020

Mostly, remove the confusing and largely redundant text from end*/else statements.

Feel free to argue about whether there should be a space or not.

sed -i 's/\(if\|macro\|elseif\|function\|foreach\)\s*(\(.*\))/\1 (\2)/' cmake/*.cmake CMakeLists.txt
sed -i 's/\(endif\|endmacro\|else\|endfunction\|endforeach\)\s*(.*)/\1 ()/' cmake/*.cmake CMakeLists.txt

@glx22
Copy link
Contributor

glx22 commented Sep 25, 2020

I'd say no space

@FLHerne
Copy link
Contributor

FLHerne commented Sep 25, 2020

+1 for consistency.

The official documentation and other CMake projects I've seen omit the space -- in CMake syntax, if() etc. are ordinary commands and not special keywords.

As I said on IRC, I don't think that matters so long as it's internally consistent.

@LordAro
Copy link
Member Author

LordAro commented Sep 25, 2020

space removed

cmake/FindFontconfig.cmake Outdated Show resolved Hide resolved
@LordAro
Copy link
Member Author

LordAro commented Sep 25, 2020

Found all the other cmake files as well...

find  \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -not -path './build/*' -exec sed -i 's/\(if\|macro\|elseif\|function\|foreach\)\s*(\(.*\))/\1(\2)/' {} \; -exec sed -i 's/\(endif\|endmacro\|else\|endfunction\|endforeach\)\s*(.*)/\1()/' {} \;

Copy link
Contributor

@glx22 glx22 left a comment

Choose a reason for hiding this comment

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

seems good

@LordAro LordAro merged commit 348c231 into OpenTTD:master Sep 25, 2020
@LordAro LordAro deleted the cmake-codestyle branch September 25, 2020 13:43
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

3 participants