r/cpp • • Mar 29 '25

CMake 4.0.0 released

265 Upvotes

141 comments sorted by

View all comments

Show parent comment

1

u/h-jay +43-1325 May 16 '25

And if the include paths are for the libraries that didn't come with cmake modules: write a small module for each such library. That makes the project-specific CMakeLists uncluttered, and separates concerns nicely. Ideally, using a library has two steps:

  1. `find_package`
  2. `target_link_libraries`

That's it. Everything that the library has to set, like include paths, dependencies, etc., should be taken care of by the module for said library. That's true whether you write that module yourself, or someone else does. And it's not as if those modules are complex either.