Skip to content

Conversation

@NeroBurner
Copy link
Contributor

@NeroBurner NeroBurner commented Sep 15, 2025

Remove the absolute include header path from the install target. The created CMake package still has the right include generated:

set_target_properties(libdeflate::libdeflate_static PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

As mentioned in the
Creating Relocatable Packages section of the CMake documentation packages created with install(EXPORT) are designed to be relocatable.

This also makes it possible to cache the install directory over multiple computer (for example through a package manager).

Remove the absolute include header path from the install target. The
created CMake package still has the right include generated:
```cmake
set_target_properties(libdeflate::libdeflate_static PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
```

As mentioned in the
[Creating Relocatable Packages](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-relocatable-packages)
section of the CMake documentation packages created with
`install(EXPORT)` are designed to be relocatable.

This also makes it possible to cache the install directory over multiple
computer (for example through a package manager).
@NeroBurner NeroBurner force-pushed the cmake_install_relocatable branch from c31404e to 75c0ad6 Compare September 15, 2025 06:32
@NeroBurner
Copy link
Contributor Author

fixed the markdown link in the commit message (sorry for the noise, I found the oopsie only after creating the PR 😅 )

NeroBurner added a commit to cpp-pm/hunter that referenced this pull request Sep 15, 2025
Need to use a patched version of `libdeflate` as the created CMake
config contains absolute paths breaking the caching.

Once ebiggers/libdeflate#434 is merged and
released we can use pure upstream.

Fixes: #804
NeroBurner added a commit to cpp-pm/hunter that referenced this pull request Sep 15, 2025
Need to use a patched version of `libdeflate` as the created CMake
config contains absolute paths breaking the caching.

Once ebiggers/libdeflate#434 is merged and
released we can use pure upstream.

Fixes: #804
NeroBurner added a commit to cpp-pm/hunter that referenced this pull request Sep 15, 2025
Need to use a patched version of `libdeflate` as the created CMake
config contains absolute paths breaking the caching.

Once ebiggers/libdeflate#434 is merged and
released we can use pure upstream.

Fixes: #804
@ebiggers ebiggers merged commit 095bcab into ebiggers:master Sep 15, 2025
47 of 49 checks passed
@ebiggers
Copy link
Owner

Merged, thanks!

@NeroBurner NeroBurner deleted the cmake_install_relocatable branch September 15, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants