Skip to content

Fix INSTALL_CMAKE_DIR for GNU_DIRS and enable by default on Linux.#6410

Open
chuckatkins wants to merge 2 commits into
HDFGroup:developfrom
chuckatkins:fix-gnu-cmake-dir
Open

Fix INSTALL_CMAKE_DIR for GNU_DIRS and enable by default on Linux.#6410
chuckatkins wants to merge 2 commits into
HDFGroup:developfrom
chuckatkins:fix-gnu-cmake-dir

Conversation

@chuckatkins

Copy link
Copy Markdown

Describe your changes

The previous value of HDF5_INSTALL_CMAKE_DIR of lib/cmake when HDF5_USE_GNU_DIRS=ON isn't in CMake's find_package search path since CMake expects that to be a common path with each package having it's own subdirectory:

Entry Convention
<prefix>/<name>/cps/ W
<prefix>/<name>/*/cps/ W
<prefix>/cps/<name>/ W
<prefix>/cps/<name>/*/ W
<prefix>/cps/ W
<prefix>/ W
<prefix>/(cmake|CMake)/ W
<prefix>/<name>*/ W
<prefix>/<name>*/(cmake|CMake)/ W
<prefix>/<name>*/(cmake|CMake)/<name>*/ W
<prefix>/(lib/<arch>|lib*|share)/cps/<name>/ U
<prefix>/(lib/<arch>|lib*|share)/cps/<name>/*/ U
<prefix>/(lib/<arch>|lib*|share)/cps/ U
<prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/ U
<prefix>/(lib/<arch>|lib*|share)/<name>*/ U
<prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ U
<prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/ W/U
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ W/U
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ W/U

This changes HDF5_INSTALL_CMAKE_DIR to lib/cmake/hdf5 when HDF5_USE_GNU_DIRS=ON so the CMake package config is now found when the install prefix is in CMAKE_PREFIX_PATH.
This also sets HDF5_USE_GNU_DIRS=ON by default for non-Windows builds.

Issue ticket number (GitHub or JIRA)

Fixes #6137

@chuckatkins

Copy link
Copy Markdown
Author

It seems the Windows / not windows default isn't working as expected. Debugging it now, will push a fix shortly

The previous `lib/cmake/hdf5-config.cmake` isn't in CMake's find_package
search path since CMake expects that to be a common path with each
package having it's own subdirectory. This changes it to
`lib/cmake/hdf5/hdf5-config.cmake` so the config is now found when the
install prefix is in `CMAKE_PREFIX_PATH`.
This also sets `HDF5_USE_GNU_DIRS=ON` by default for non-Windows builds.

Fixes HDFGroup#6137
@lrknox lrknox self-assigned this May 29, 2026
@jhendersonHDF

Copy link
Copy Markdown
Collaborator

Thanks for these changes @chuckatkins. We probably need to do some more testing but this generally looks fine; I think my only concern is enabling HDF5_USE_GNU_DIRS for all non-Windows. I'm aware of CMake's table for where find_package looks, though just having W/U/A doesn't clarify much about where CMake will search on non-Windows, non-Unix, non-Apple platforms.

@lrknox lrknox requested a review from hyoklee as a code owner June 5, 2026 19:32
@github-actions github-actions Bot added the stale label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has had no activity for 30 days and has been marked stale. Push a commit or comment to keep it open, or it will be flagged for maintainer review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

*.cmake files are installed in a not standard cmake directory

3 participants