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

Modern CMake for fun & profit #135

Closed
Morwenn opened this issue Aug 21, 2018 · 6 comments
Closed

Modern CMake for fun & profit #135

Morwenn opened this issue Aug 21, 2018 · 6 comments
Labels
Milestone

Comments

@Morwenn
Copy link
Owner

Morwenn commented Aug 21, 2018

The current CMake is "pragmatic" which means that it roughly gets the job done somehow and that's pretty much it. It should be time to read some tutorials and actually get some decent modern CMake in this library, especially now that Catch2 provides a modern CMake interface.

Myabe throw in some ideas from here as well: https://github.com/vector-of-bool/vector-of-bool.github.io/blob/master/_drafts/project-layout.md

@stefanos82
Copy link

What's your opinion for Meson?

Personally I find it much more convenient and a lot easier to use than CMake.

For some reason, I cannot fathom CMake...don't ask why 😕

@Morwenn
Copy link
Owner Author

Morwenn commented Sep 5, 2018

I don't have any opinion because I never tried Meson.

I simply picked CMake because it's apparently the most used, which makes it easier to find examples and help. Plus it's also the one used by the testing framework used by cpp-sort, Catch2, which also provides a few tools to make tests discovery easier.

Save for a few problems linked to valgrind command line options, the modern-cmake branch is almost finished anyway :p

@stefanos82
Copy link

I guess my dislike towards CMake has to do with its lack of proper documentation.

Still with meson all you need is some basic Python, that's all.

Do you have any suggestion around CMake, that is how to use it properly?

@Morwenn
Copy link
Owner Author

Morwenn commented Sep 5, 2018

Not really, I first looked at a few articles, mostly the ones below:

I then compared this new-found knowledge to other header-only projects, tried to get a first semi-working version for this library then solved the specific problems I had one one, by looking at StackOverflow questions & answers, or old forum posts or mailing lists, or by checking how other projects solved similar problems. CMake has a complete reference, but it is true that it lacks examples of how to use things properly. More often than not I end up looking for solutions on the internet and/or trying things that seem to make sense.

@stefanos82
Copy link

That's one of the main reasons I prefer sticking with traditional makefiles and when I need portability, I simply go with Meson.

It's extremely easy to use and has an incredible documentation that demonstrates everything.

More and more projects are moving from Autotools to Meson.

@Morwenn
Copy link
Owner Author

Morwenn commented Sep 6, 2018

Closed by #137, which roughly does the following:

  • Properly create, use and export CMake target
  • Install CMake files
  • Download Catch2 during the configuration step, not the build step
  • Automatically discover Catch2 tests instead of having a single test for the whole test suite
  • Use Valgrind through CTest memcheck step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants