Build system does not correctly deal with absolute CMAKE_INSTALL_INCLUDEDIR
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
If you look at https://github.com/facebook/hhvm/blob/c01e354aab932704caee4a5a019149133c6866ca/CMake/HPHPFunctions.cmake#L220-L224, you see the following cmake code:
```cmake
install(
CODE "INCLUDE(\"${HPHP_HOME}/CMake/HPHPFunctions.cmake\")
HHVM_INSTALL_HEADERS(${TARGET} ${HPHP_HOME}
\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\" ${ARGN})"
COMPONENT dev)
```
If `CMAKE_INSTALL_INCLUDEDIR` is an absolute path (such as `/usr/include`), and `CMAKE_INSTALL_PREFIX` is not `/` (for example, `/usr`), then this code is wrong, since we always interpret `CAMKE_INSTALL_INCLUDEDIR` as relative to the prefix (in the example, the include files would be installed into `/usr/usr/include`).
This is a problem if `CMAKE_INSTALL_INCLUDEDIR` is not a subdirectory of `CMAKE_INSTALL_PREFIX` (for example, for distributions where include files are in a different package the prefix might be different).
Contributor guide
Assessment
This issue has not been assessed yet.