Naming Conventions
Let's learn about naming conventions in CMake.
Naming is famously hard in software development, but nevertheless, it's very important to maintain a solution that is easy to read and understand. When it comes to CMake scripts and projects, we should follow the rules of the clean code approach, as we would with any software development solution:
Follow a consistent naming style (
snake_case
is an accepted standard in the CMake community).Use short but meaningful names (for example, avoid
func()
,f()
, and suchlike).Avoid puns and unnecessary cleverness in our naming.
Use pronounceable, searchable names that don't require mental mapping.
Get hands-on with 1200+ tech skills courses.