Skip to content

Build Issue

CMake Preset Error

Problem:

An error occurs when running CMake with the --preset option: "The source directory does not exist."

Error Message:

bash
user@hostname:~/project-directory$ cmake --preset conan-release
CMake Error: The source directory "/home/user/project-directory/conan-release" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

Solution:

Check CMake Version:

  • This error is often caused by using an older CMake version. Ensure that your CMake version is 3.23 or higher.
bash
cmake --version
  • If the version is outdated, refer to the installation process in the CMake installation section to upgrade to the latest version.

In most cases, the issue can be resolved by following the above steps. If the problem persists, review the following items.

Additional Checks:

  • Preset Path: Make sure you are running the CMake command from the project's root directory.
  • Preset Name: Verify that the preset name defined in the CMakePresets.json file is correct.
  • Git Submodule: Ensure that the submodules are properly initialized when cloning the project.
bash
git submodule update --init --recursive

References: