# Bug: Target install should allow possible absolute CMAKE\_INSTALL\_INCLUDEDIR

**URL:** https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353
**Category:** Development
**Created:** [June 19, 2023, 5:04pm UTC](https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353 "2023-06-19T17:04:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ItsBasi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/itsbasi/32/3538_2.png) [@ItsBasi](https://discourse.cmake.org/u/ItsBasi)
#### Post date: [June 19, 2023, 5:04pm UTC](https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353/1 "2023-06-19T17:04:25Z")

</div>

According to [GNUInstallDirs](https://cmake.org/cmake/help/git-master/module/GNUInstallDirs.html#module:GNUInstallDirs) an absolute CMAKE\_INSTALL\_INCLUDEDIR should be expected by install(TARGETS FILE\_SET HEADERS).

But cmake generates configs which constructs include directories like “D:/Repositories/cmake/build/Tests/RunCMake/target\_sources/FileSetAbsoluteInstallIncludeDirExport-build/install/D:/Repositories/cmake/build/Tests/RunCMake/target\_sources/FileSetAbsoluteInstallIncludeDirExport-build/install/include” or “/nix/store/-//nix/store/-/include”.

Originally i discovered the issue while using NixOS, where they use absolute paths only for CMAKE\_INSTALL\_DIR.

```auto
-DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF
-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON
-DCMAKE_BUILD_TYPE=Release
-DBUILD_TESTING=OFF
-DCMAKE_INSTALL_LOCALEDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/share/locale
-DCMAKE_INSTALL_LIBEXECDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/libexec
-DCMAKE_INSTALL_LIBDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/lib
-DCMAKE_INSTALL_DOCDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/share/doc/hello
-DCMAKE_INSTALL_INFODIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/share/info
-DCMAKE_INSTALL_MANDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/share/man
-DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/include
-DCMAKE_INSTALL_INCLUDEDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/include
-DCMAKE_INSTALL_SBINDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/sbin
-DCMAKE_INSTALL_BINDIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/bin
-DCMAKE_INSTALL_NAME_DIR=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello/lib
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW
-DCMAKE_OSX_SYSROOT=
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_STRIP=/nix/store/d9fndiing52fkalp5knfalrvlb3isi6w-gcc-wrapper-12.2.0/bin/strip
-DCMAKE_RANLIB=/nix/store/d9fndiing52fkalp5knfalrvlb3isi6w-gcc-wrapper-12.2.0/bin/ranlib
-DCMAKE_AR=/nix/store/d9fndiing52fkalp5knfalrvlb3isi6w-gcc-wrapper-12.2.0/bin/ar
-DCMAKE_C_COMPILER=gcc
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_INSTALL_PREFIX=/nix/store/hnxnbjbcgbl8gj30bb8cd90w5l5kmzmh-my-hello

```

I think this is a bug in the recent 3.23 FILE\_SET feature.  
[This](https://gitlab.kitware.com/ItsBasi/cmake/-/commits/install-targets-absolute-cmake-install-includedir) contains a failing test.

Your thoughts?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 20, 2023, 2:20pm UTC](https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353/2 "2023-06-20T14:20:52Z")

</div>

Is there a reason that `CMAKE_INSTALL_PREFIX` and relative paths isn’t sufficient?

Cc: @kyle.edwards

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 20, 2023, 2:30pm UTC](https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353/3 "2023-06-20T14:30:45Z")

</div>

Yeah, this is a bug. ~~Go ahead and open an issue at [https://gitlab.kitware.com/cmake/cmake/-/issues](https://gitlab.kitware.com/cmake/cmake/-/issues).~~ I’ve opened an issue at [https://gitlab.kitware.com/cmake/cmake/-/issues/25010](https://gitlab.kitware.com/cmake/cmake/-/issues/25010).

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 20, 2023, 2:52pm UTC](https://discourse.cmake.org/t/bug-target-install-should-allow-possible-absolute-cmake-install-includedir/8353/4 "2023-06-20T14:52:54Z")

</div>

I’ve opened [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/8577](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8577) to fix this. @ItsBasi since you wrote the test case, how would you like to be credited in the commit message? (I see your commit message has an auto-generated GitHub email address.)
