winft / wrapland

Qt/C++ library wrapping libwayland
GNU Lesser General Public License v2.1
6 stars 2 forks source link

Apply cmake-format to CMake files #81

Closed romangg closed 5 months ago

romangg commented 2 years ago

To improve our code styling we require the usage of clang-format on our code.

The CMake files need formatting too. For that cmake-format exists.

It was applied already once in the past by me with some configuration and additional manual changes on Disman with disman@2790ce2677cbd5551e26b150c0941ea072592b34. Because some manual changes were prepared cmake-format was not enforced in the CI.

For Wrapland we want to also at least initially apply cmake-format once and if possible also integrate it now in our CI.

romangg commented 2 years ago

marked this issue as related to #63

romangg commented 2 years ago

I've to look if I still have the cmake-format configuration file around which I used in disman@2790ce2677cbd5551e26b150c0941ea072592b34.

romangg commented 2 years ago

Found the file: https://gitlab.com/-/snippets/2164208

romangg commented 2 years ago

In Disman cmake-format was applied once but manually changes were done afterwards, so it's not enforced on CI at the moment.

If I remember correctly the primary reason for that was that cmake-format does not leave the first argument for a function like find_package on the first line.

For example it replaces

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
  Core
  DBus
  Gui
  Test
)

with

find_package(
  Qt5
  ${QT_MIN_VERSION}
  CONFIG
  REQUIRED
  Core
  DBus
  Gui
  Test
)

There exists open feature request cmake_format#137 for keeping the first argument(s) on the first line. Once this has been solved we might think again about enforcing cmake-format. For now we should only use the cmake-format config linked above locally and then correct the result manually.

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 20, 2021, 20:42

I've created a small helper script for cmake-format to facilitate the task here : https://gitlab.com/aramgrigoryan/cmakeformatter written rapidly, but showed, here locally, that can help speed up the task!

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 19:19

mentioned in commit aramgrigoryan/wrapland@b189252b2502d56372cf6348de1e226e859f1c7f

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 19:19

mentioned in commit aramgrigoryan/wrapland@e1567475f2adb85411e19f01caac56c5363d718c

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 19:19

mentioned in commit aramgrigoryan/wrapland@96c184ee5a87c892be125289f7b6d222d0b8622d

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 19:30

mentioned in commit aramgrigoryan/wrapland@0dc7ead2037e3f14df472a861a2babe4bb016ceb

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 19:46

mentioned in commit aramgrigoryan/wrapland@c6eda81ae4d33d59c4b30a607069670e00fe1424

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 21:35

mentioned in commit aramgrigoryan/wrapland@79882435a00c77f8db2531afd39f143d6a076c99

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 21:48

mentioned in commit aramgrigoryan/wrapland@e08477944516d06935d28290c75106df4705f7bf

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 21:51

mentioned in commit aramgrigoryan/wrapland@c3757559f66def70b4fbbb5fff168e9f88002bfa

romangg commented 2 years ago

In GitLab by @aramgrigoryan on Aug 23, 2021, 22:44

mentioned in commit aramgrigoryan/wrapland@7f0573c8490725f24436889419160f69c6c0f908