# Make CMake error give the full path to the faulty CMakeLists.txt

**URL:** <https://discourse.cmake.org/t/make-cmake-error-give-the-full-path-to-the-faulty-cmakelists-txt/1072>\
**Category:** Code\
**Created:** [April 22, 2020, 5:16pm UTC](https://discourse.cmake.org/t/make-cmake-error-give-the-full-path-to-the-faulty-cmakelists-txt/1072 "2020-04-22T17:16:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![developer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@developer](https://discourse.cmake.org/u/developer)\
**Post date:** [April 22, 2020, 5:16pm UTC](https://discourse.cmake.org/t/make-cmake-error-give-the-full-path-to-the-faulty-cmakelists-txt/1072/1 "2020-04-22T17:16:52Z")

</div>

Given a simple structure:

```auto
- project
--- CMakeLists.txt
--- lib
--- --- CMakeLists.txt

```

The top level CMakeLists.txt file just does an `add_subdirectory(lib)`. If the lib `CMakeLists.txt` file is faulty, an error like the following is given:

```auto
CMake Error at lib/CMakeLists.txt:1:
  Parse error. Expected a command name, got unquoted argument with text...

```

**Is there a way to configure the project such that the `lib/CMakeLists.txt` is a full path? This would simply make IDE integration better.** Thank you!

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [April 27, 2020, 1:38pm UTC](https://discourse.cmake.org/t/make-cmake-error-give-the-full-path-to-the-faulty-cmakelists-txt/1072/2 "2020-04-27T13:38:46Z")

</div>

There is, AFAIK, no way to force full paths there.

FWIW, we currently rely on that in our test harnesses (where we use regexes to match output). The backtrace stack printing would also need changed.

However, the only relative paths are those to the top-level source directory which seems like something IDEs can assume when handling CMake output to me.

Cc: @brad.king

---

<div class="post-metadata">

**Author:** ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)\
**Post date:** [April 28, 2020, 12:44pm UTC](https://discourse.cmake.org/t/make-cmake-error-give-the-full-path-to-the-faulty-cmakelists-txt/1072/3 "2020-04-28T12:44:00Z")

</div>

There is not currently a way to get an absolute path in that message. If the file is inside the top-level source tree (or build tree IIRC) then it will be expressed relative to that. I think some IDEs have been able to handle that but it does take special logic.

For reference, I searched the old mailing list archives and found this was raised before:

- [https://cmake.org/pipermail/cmake/2013-July/055361.html](https://cmake.org/pipermail/cmake/2013-July/055361.html)
- [https://cmake.org/pipermail/cmake/2014-March/057139.html](https://cmake.org/pipermail/cmake/2014-March/057139.html)
- [https://cmake.org/pipermail/cmake/2014-June/057836.html](https://cmake.org/pipermail/cmake/2014-June/057836.html)

I’ve opened [CMake Issue 20649](https://gitlab.kitware.com/cmake/cmake/-/issues/20649) for this.
