Problems with Step2 of the CMake Tutorial

I am doing the Step 2 of CMake tutorial (https://cmake.org/cmake/help/latest/guide/tutorial/Adding%20a%20Library.html).
After I have finished all the steps I have a problem when trying to build my code. The error is:
“CMake Error at CMakeLists.txt:43 (target_include_directories):
Cannot specify include directories for target “MathFunctions” which is not
built by this project.”
Can anyone help with this? I can provide more details because I might have done something wrong in my solution

As the error clearly states the target you want to add an include directory for does not exist. What the cause for that is, is hard to say without seeing your CMakeLists.txt

You may download the working Tutorial here

Hi,
I have encountered the same problem and the solution for me was to move the command target_include_directories(…) to the end of the file.
You can find working version of it here: https://github.com/git-code-learner/cmake-tutorial.git
Hope it helps!