FW: Cmake Tutorial Step 1 Error

Removed embedded media items

Should be cmake … not cmake …/Step1 unless you put Step1_build at the same directory level as Step1.

In the first post, the attached image shows that the Step1_build is a sub-folder of Step1
Also from what I can find, cmake …( 3 dots) is not a valid command, 2 dots are.

I tried “cmake …/Step1_build” but it returned an error

“mike@DESKTOP-A13TGH3:/mnt/c/CmakeTutorial/Step1/Step1_build$ cmake …/Step1_build
CMake Error: The source directory “/mnt/c/CmakeTutorial/Step1/Step1_build” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Got the same error with windows ubuntu and mingw-w64

There appear to be an error in the tutorial or I am doing something wrong.
If there is something wrong with the tutorial, I hope someone can correct the website.
I am hopping someone can help.

True, but it shouldn’t be. Quoting the CMake tutorial:

For example, from the command line we could navigate to the Help/guide/tutorial directory of the CMake source code tree and create a build directory:

mkdir Step1_build

Notice there’s no Step1 in the “navigate to” directory. The idea is to create Step1_build as a sibling to Step1.

I don’t understand. How do I nagvigate to the Help/guide/tutorial directory of the CMake source code tree, did not find it on my computer.
I did on 1/17/23 download cmake-3.25.1-tutorial-source.zip, unzipped to my C drive and that where I navigated too.

The tutorial needs an update:
The path described is inside the CMake source tree, where it’s maintained.
If you use the separate ZIP, which only contains the tutorial, it’s the toplevel directory that has the README and where you can see all the StepX subdirectories.

If I understand what you wrote, the tutorial is unusable.
Thanks for sharing.

Not unusable:
The tutorial sources were (and still are) part of the CMake source tree.
It was only recently that the tutorial sources were extracted as separate ZIP file for convenience. And that single sentence was not improved to explain that there are now 2 different possibilities.

In general the tutorial is working fine.

Great, how do I get to the working tutorial?
Where do I find the “CMake source tree”, " Help/guide/tutorial" is not on my computer from the install of cmake.
“And that single sentence was not improved to explain that there are now 2 different possibilities.”
What are the two possibilities and how can I use them, get to them.

To demonstrate how broken CMake Tutorial is, the following are errors in the tutorial

  1. Starting page of tutorial, https://cmake.org/cmake/help/latest/guide/tutorial/index.html

“The tutorial source code examples are available in “this archive”. Each step”,
the link is broken and the link open a tab/window with “Not Found”

  1. [Step 1: A Basic Starting Point]

2a) “Each file in the Files to Edit section”, where is the “Files to Edit section”

2b) “The source code for tutorial.cxx is provided in the Help/guide/tutorial/Step1”, where is “Help/guide/tutorial”

2c) “Once TODO 1 through TODO 3 have been completed, we are ready to build and run our project!”, the CMakeLists.tx has 9 TODO in it. Do you do only TODO1 → TODO3? The tutorial only show answers for TODO1 → TODO3

2d) “create a build directory:” using “mkdir Step1_build”

2e) “Next, navigate to that build directory and run cmake to configure the project and generate a native build system:”

cd Step1_build switch to folder Step1_build

cmake …/Step1 causes a error, should be cmake …/Step1_build

2f) The “cmake …/Step1_build” will run without errors if a copy of the CMakeLists.txt is put in the Step1_build folder and the only TOD1 =>TODO2 are included. DOTO3 will cause an error.

I hope this give you an idea of how badly the tutorial is broken

If you either download the source zip or clone the git repo of CMake, you will have the source tree of CMake, If you installed CMake, you only have a compiled binary.

  1. Please try again, the download is working.

2a) Please see wikipedia for the definition of the word section. That’s a common word for books and documentation, just like chapter. Please look at the headlines of the Exercises and you will see “Files to Edit”
2b) As explained Help/guide/tutorial is inside the original CMake source tree. If you downloaded the standalone tutorial, that directory corresponds to cmake-3.25.2-tutorial-source (depending on the version) in the zip. Or /mnt/c/CmakeTutorial of your first screen shot.
2c) The tutorial for Step 1 explains all TODOs. You have read just the first Exercise which starts with the first 3 TODOs.
2d) I guess you had no problem with that, just stated what you did next
2e) The tutorial is correct, you mistyped your call: there must be 2 dots, not 3
2f) It works. I used the commands as documented in the solution of Exercise 1 and they’re fine.