Tutorial Step 5 does not work as presented

I’m really new to CMake, and I’ve been following the tutorial at https://cmake.org/cmake/help/latest/guide/tutorial/index.html#adding-system-introspection-step-5.

The instructions for running step 5 do not work. For one thing, the line "#include " is required in the mysqrt.cxx source, but this is never mentioned in the tutorial.

Also, in the first part of this step, there are instructions for how to get mysqrt.cxx to include the TutorialConfig.h file, but the changes described do not work. I get syntax errors when I try to build.

I found this out by comparing my source to the Step 6 source.

I hope someone can verify this and correct it because this kind of misinformation is very confusing to new users.

Thank you.

@betsy.mcphail please take a look at these steps in the tutorial.

For reference, the tutorial says

Modify mysqrt.cxx to include cmath.

However, I’m not in the right position to judge whether it is clear enough.

What errors do you get exactly?

I completely missed that.

The instructions for the TutorialConfig.h include I followed and double-checked. I couldn’t get that to work at all.

What syntax errors are you seeing? Is this the part of the instructions that are problematic?

We will also need to update MathFunctions/CMakeLists.txt so mysqrt.cxx knows where this file is located:


Ah, now I see - the only flaw was the missing "#include " line.

My apologies. Perhaps this could be called out as a separate paragraph to make it crystal clear to newbs like myself.

No problem! I submitted a merge request to make that section more clear (https://gitlab.kitware.com/cmake/cmake/merge_requests/4231)