Last week I was using my own CMake book for a new project. Yes, I refer back to my own book, because The CMake Tutorial also makes a great reference! Anyway, this is when I stumbled on a mistake.
I wanted to create a symbolic link from the build directory to a data directory, and the code example said to use “add_custom_data().” Needless to say, CMake had no idea what to do with that code.
I quickly realized that it was supposed to be “add_custom_command().” So, I’ve corrected the book.
I also updated the command line steps to build software using CMake.Here’s what the book originally said:
mkdir build
cd build
cmake ..
cmake --build . --parallel
Two readers pointed out that this is a bit tedious, and you don’t need to do it that way. Here’s a faster way:
cmake -B build
cmake --build build --parallel
Two lines instead of four. Clearly more convenient, and it’s been possible since late 2018.
So I’ve gone through the book, and updated the command line build steps, everywhere.
Download the Updated Version
As usual, everyone who has bought The CMake Tutorial can download the updated version using the download link in their order, or via their account. If you have any trouble, just contact me, and I’ll sort it out for you.
Get the Book
If you don’t yet have the book, then you can fix that by going to https://cmaketutorial.com/.
P.S., The video related to the project I told you about, will be out soon…