TheLartians / ModernCppStarter

🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.
https://thelartians.github.io/ModernCppStarter
The Unlicense
4.33k stars 381 forks source link

Use ${PROJECT_NAME} instead of writing projectname multiple times #134

Closed DominicD closed 2 years ago

DominicD commented 2 years ago

resolves #133

DominicD commented 2 years ago

Hey, thanks for the PR! It definitely makes adapting the template easier. There seem to be some failed CI tests - could you run cmake-format (or the CMake target fix-format) and check if the use of ${CMAKE_PROJECT_NAME} is correct?

Currently I am not able to run cmake-format I will first have to figure out how that works.

ClausKlein commented 2 years ago

Hey, thanks for the PR! It definitely makes adapting the template easier. There seem to be some failed CI tests - could you run cmake-format (or the CMake target fix-format) and check if the use of ${CMAKE_PROJECT_NAME} is correct?

Currently I am not able to run cmake-format I will first have to figure out how that works.

pip install cmakelang
cmake-format -i *.cmake ...
TheLartians commented 2 years ago

Currently I am not able to run cmake-format I will first have to figure out how that works.

The easiest way to format all the code (cmake /C++) should be:

# configure tests (or "all" targets using `cmake -S all -B build`)
cmake -S test -B build/test
# run the `fix-format` target
cmake --build build/test --target fix-format

Of course you should have clang-format and cmake-format installed as shown above.

TheLartians commented 2 years ago

@DominicD is the PR still active? I would be happy to merge once CI checks pass. IMO the best approach would be to change CMAKE_PROJECT_NAME back to Greeter and run the formatting target as mentioned above.

DominicD commented 2 years ago

@DominicD is the PR still active? I would be happy to merge once CI checks pass. IMO the best approach would be to change CMAKE_PROJECT_NAME back to Greeter and run the formatting target as mentioned above.

@TheLartians I am very sorry but I had no time yet to do it. I hope I will find some time this week.