Tutorial Step 1 Possible Oversight?

I’ve just finished Step 1 of the tutorial and I got stuck for a while on TODO 10. I’ve figured it out now but thought I’d put a word in here about it.

TODO 7 asks us to specify the version as 1.0 in CMakeLists.txt. We later use configure_file() to create the TutorialConfig.h file in the builds directory. However, when I finished the section up and tried to build, I got an error saying that Tutorial_VERSION_MINOR was undeclared.

I believe this is because when Tutorial_VERSION_MINOR is zero, configure_file() considers it to be “OFF.” This is corroborated by the TutorialConfig.h file in the builds directory, which looks like this:

#define Tutorial_VERSION_MAJOR "1"
/* #undef Tutorial_VERSION_MINOR */

If I make the version 0.0, TutorialConfig.h looks like this:

/* #undef Tutorial_VERSION_MAJOR */
/* #undef Tutorial_VERSION_MINOR */

I’m not sure if I have a slightly different system or if I missed something, but I followed the instructions quite closely. I’m not sure how other people didn’t run into this problem to be honest.

What does your TutorialConfig.h.in file look like? I just tried it out following the tutorial steps and it works as expected. Did you by chance use #cmakedefine? That would have the behavior you’ve described. If you just use a normal #define, it should work. That’s what TODO 10 has specified.

Oh yeah that’s exactly it, I got caught up a bit in the configure_file() documentation. I mistook #cmakedefine for the standard syntax of the .h.in files. Thanks!