Commit 0e3f132
Use GNUInstallDirs for CMake install paths
Summary:
fbthrift rolled its own `BIN_INSTALL_DIR` / `LIB_INSTALL_DIR` /
`INCLUDE_INSTALL_DIR` / `CMAKE_INSTALL_DIR` cache variables, and hard-coded
destinations like `include/thrift` elsewhere. That ignores platform
conventions — notably `lib64` on multilib distros — and `CMAKE_INSTALL_DIR`
reads like a CMake builtin but is not one.
The top level now includes `GNUInstallDirs`, and every destination uses
`CMAKE_INSTALL_BINDIR` / `LIBDIR` / `INCLUDEDIR`. The Python wheel directory
stays a literal `share/thrift/wheels`, because out-of-tree consumers glob it
by path. The package config directory becomes `THRIFT_INSTALL_CMAKEDIR`,
defaulting to `${CMAKE_INSTALL_LIBDIR}/cmake/fbthrift`. All destinations stay
relative, so `CMAKE_INSTALL_PREFIX`, `DESTDIR` and CPack keep working.
The old variables are removed outright rather than aliased. See the
compatibility note below.
The compiler is now referenced as a target rather than a constructed path:
- `FBThriftConfig.cmake.in` no longer builds
`PACKAGE_BIN_INSTALL_DIR@/thrift1{,.exe}`. The exported
`FBThrift::thrift1` target already carries the right suffix per platform.
`FBTHRIFT_COMPILER` is kept for existing consumers, now derived from that
target's `LOCATION`.
- `thrift_generate` passed `$<TARGET_FILE:${THRIFT1}>` and needed an
`if (TARGET ...)` branch because that generator expression is a hard error
on a non-target. Passing `${THRIFT1}` straight to `COMMAND` works for a
real target, an imported target and a plain path alike, and CMake adds the
target-level dependency itself, so the branch is gone.
`ThriftLibrary.cmake` now includes `GNUInstallDirs` itself, since consumers
include that file directly and cannot be assumed to have pulled it in.
**Breaking change.** `-DBIN_INSTALL_DIR=...`, `-DLIB_INSTALL_DIR=...`,
`-DINCLUDE_INSTALL_DIR=...` and `-DCMAKE_INSTALL_DIR=...` are now silently
ignored, and installs that used them move to the GNUInstallDirs defaults.
Neither `fbcode_builder` manifest sets any of them, so nothing in-repo is
affected; the exposure is external consumers of the OSS CMake build, who
should switch to the `CMAKE_INSTALL_*DIR` equivalents.
Reviewed By: yfeldblum
Differential Revision: D119207266
fbshipit-source-id: 04fe31fd5e5c4b2092d19868b7400c1ae80aa22f1 parent 6b4a045 commit 0e3f132
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
0 commit comments