Commit cabec72
authored
## Summary of Changes
On distributions such as Arch Linux and Fedora where `/lib` is a symlink
to `/usr/lib`, `CMAKE_CURRENT_LIST_FILE` may resolve to
`/lib/cmake/CGAL/CGALConfig.cmake`. The subsequent chain of
`get_filename_component(... DIRECTORY)` calls then walks up through the
symlink path, producing `CGAL_ROOT=/` instead of `/usr`, and the
existence check for `include/CGAL/config.h` fails — even though CGAL is
properly installed.
**Fix:** resolve the real path of `CMAKE_CURRENT_LIST_FILE` before
extracting the directory. Uses `file(REAL_PATH)` when available (CMake
>= 3.19), with a `get_filename_component(... REALPATH)` fallback for
CMake 3.15–3.18.
Reproducer (from @lrineau's comment):
```
CGAL_DIR=/lib/cmake/CGAL cmake . -B build
# → CGAL_FOUND=FALSE, even though CGAL is installed
```
## Release Management
* Affected package(s): Installation
* Issue(s) solved (if any): fix #8521
* License and copyright ownership: same as CGAL
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
| |||
0 commit comments