Assert that the repo directory is named `executorch` (#6480)
Our C++ include path assumes that the repo lives in a directory named exactly `executorch`. Users who name it something else run into hard-to-debug issues (see #6475).
Since we require it, add an explicit check and point users to the issue that tracks the fix.
## Test Plan
Tried generating cmake files under a directory named `executorch` and named `not-executorch`:
```
(rm -rf cmake-out \
&& mkdir cmake-out \
&& cd cmake-out \
&& cmake ../)
```
Note that I added a trailing slash just in case CMAKE_CURRENT_SOURCE_DIR included that slash and might confuse `cmake_path()`. (note that CMAKE_CURRENT_SOURCE_DIR does not include the trailing slash in this case)
This command succeeded when the directory is named `executorch`.
Under `not-executorch` it failed with the error:
```
CMake Error at CMakeLists.txt:332 (message):
The ExecuTorch repo must be cloned into a directory named exactly
`executorch`; found `not-executorch`. See
https://github.com/pytorch/executorch/issues/6475 for progress on a fix for
this restriction.
```
Also tested with the instructions at [pytorch.org/executorch/main/llm/getting-started.html](https://pytorch.org/executorch/main/llm/getting-started.html), where executorch is a sub-repo of the top project. It builds when following the directions, but if I rename the repo to third-party/not-executorch then I see the expected error. D
Dave Bort committed
efa462810679da37ad1f74b3a84476fbea661dbe
Parent: 7b03a8b
Committed by GitHub <noreply@github.com>
on 11/14/2024, 12:04:53 AM