Skip to content

Commit 65fc7ad

Browse files
committed
Document include-path collision workaround in INSTALL.md, refs #222
1 parent 8e92456 commit 65fc7ad

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

INSTALL.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,34 @@ You can download and install FunctionalPlus using the [vcpkg](https://github.com
229229
./vcpkg install fplus
230230

231231
The fplus port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
232+
233+
234+
Avoiding include-path collisions on shared install prefixes
235+
-----------------------------------------------------------
236+
237+
A system install via [way 1](#way-1-using-cmake) places the headers in
238+
`<prefix>/include/fplus/` (for example `/usr/local/include/fplus/`). If the
239+
same prefix later ends up on the include path of a project that also pulls
240+
in another copy of FunctionalPlus from a different prefix (e.g. via Conan or
241+
vcpkg), `#include <fplus/fplus.hpp>` will resolve based on the order of `-I`
242+
flags and may silently pick the wrong copy. See
243+
[#222](https://github.com/Dobiasd/FunctionalPlus/issues/222) for background.
244+
245+
Consumers using the CMake package (`find_package(FunctionalPlus)` together
246+
with `target_link_libraries(... FunctionalPlus::fplus)`) are unaffected,
247+
because the package config carries the exact include directory.
248+
249+
Distro/system packagers and anyone wanting the headers under a uniquely
250+
named subdirectory can install with:
251+
252+
```bash
253+
cmake -S FunctionalPlus -B FunctionalPlus/build \
254+
-D CMAKE_INSTALL_INCLUDEDIR=include/FunctionalPlus
255+
cmake --build FunctionalPlus/build
256+
sudo cmake --install FunctionalPlus/build
257+
```
258+
259+
The headers then land in `<prefix>/include/FunctionalPlus/fplus/`. The
260+
CMake package keeps working unchanged; consumers not using the CMake
261+
package need to add `<prefix>/include/FunctionalPlus` to their include
262+
path.

0 commit comments

Comments
 (0)