CMake "source directory does not appear to contain CMakeLists.txt" in CI
CMake looked for CMakeLists.txt in the directory it was given and did not find one. The -S path is wrong, or the project lives in a subdirectory.
What this error means
Configure aborts saying the source directory does not contain CMakeLists.txt, often because CI runs cmake from the repo root while the project is nested.
cmake
CMake Error: The source directory "/work" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.Common causes
How to fix it
Point -S at the project root
- Pass the directory that actually contains CMakeLists.txt to -S.
- Verify the file is present in the checkout.
cmake
cmake -S ./src -B build # directory holding CMakeLists.txtHow to prevent it
- Use explicit -S and -B paths in CI and confirm the working directory matches the project layout.
Related guides
CMake "Cannot find source file" in CIFix CMake "Cannot find source file" in CI - a file listed in add_executable/add_library does not exist at the…
CMake "Could not find a package configuration file provided by X" in CIFix CMake "Could not find a package configuration file provided by X" in CI - find_package(CONFIG) cannot loc…