Skip to content

Align CMake compiler wrappers with old Autotools versions#5649

Merged
lrknox merged 1 commit intoHDFGroup:developfrom
jhendersonHDF:align_compiler_wrappers
Jul 28, 2025
Merged

Align CMake compiler wrappers with old Autotools versions#5649
lrknox merged 1 commit intoHDFGroup:developfrom
jhendersonHDF:align_compiler_wrappers

Conversation

@jhendersonHDF
Copy link
Collaborator

@jhendersonHDF jhendersonHDF commented Jul 7, 2025

Implemented missing --help/-h, -c, -echo and -shlib/-noshlib options

Added new -nohl option to avoid building and linking against high-level HDF5 libraries if desired

Implemented adding of HDF5 installation library directory to rpath of resulting executable/library and added new -norpath option to avoid this behavior if desired

Added parsing of HDF5_USE_SHLIB environment variable to determine whether to link against shared or static HDF5 libraries

Added parsing of HDF5_PKG_CONFIG_ARGS environment variable to separate pkg-config-specific options from compiler-specific options and prevent conflicts

Fixed several issues in pkg-config files generated by CMake

Fixes #4582


Important

Aligns CMake compiler wrappers with Autotools by adding missing options, rpath handling, and fixing pkg-config issues.

  • Behavior:
    • Implemented --help/-h, -c, -echo, -shlib/-noshlib options in CMake compiler wrappers.
    • Added HDF5 library directory to rpath by default; -norpath option to disable.
    • Parses HDF5_USE_SHLIB to decide between shared/static libraries.
    • Parses HDF5_PKG_CONFIG_ARGS to separate pkg-config and compiler options.
  • Pkg-config:
    • Fixed issues in pkg-config files generated by CMake.
  • Scripts:
    • Changed mkdir to mkdir -p in test-pc.sh scripts across multiple directories.

This description was created by Ellipsis for 9387696. You can customize this summary. It will automatically update as commits are pushed.

@jhendersonHDF jhendersonHDF added Priority - 1. High Component - Tools Command-line tools like h5dump, includes high-level tools labels Jul 7, 2025
@jhendersonHDF jhendersonHDF added Component - Wrappers C++, Java & Fortran wrappers Component - Build CMake files labels Jul 7, 2025
@github-project-automation github-project-automation bot moved this to To be triaged in HDF5 - TRIAGE & TRACK Jul 7, 2025
@jhendersonHDF
Copy link
Collaborator Author

jhendersonHDF commented Jul 7, 2025

Re: #4582 -

  • -help, --help, -h)
    - Added both other forms

  • -c)
    - Brought over the same behavior as Autotools for compatibility. Combined
    with -show, just shows the compile options without linking options.
    Without -show, just passes -c on to compiler, though this could be
    problematic for some compilers.

  • -o)
    - Just passed through to compiler

  • -E|-M|-MT)
    - Will be passed through directly to compiler instead
    of being an h5cc-specific option.

  • -l*)
    - Will be passed through directly to compiler instead
    of being an h5cc-specific option. Some logic in Autotools
    scripts to redirect to right name when -lhdf5 is specified
    but static builds are used, but this should generally be
    able to be covered by pkg-config + compiler.

  • -prefix=*)
    - Dropped as it doesn't appear to have done
    anything previously; the internal variable
    wasn't used. Can be added back in the future
    if needed, but should generally be covered
    by pkg-config except for odd cases.

  • -echo)
    - Newly brought over

  • -show)
    - Already implemented

  • -showconfig)
    - Already implemented

  • -shlib)
    - Newly brought over

  • -noshlib)
    - Newly brought over

  • -nohl)
    - New option

  • -norpath)
    - New option

@jhendersonHDF

This comment was marked as outdated.

brtnfld
brtnfld previously approved these changes Jul 16, 2025
Copy link
Collaborator

@brtnfld brtnfld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

byrnHDF
byrnHDF previously approved these changes Jul 17, 2025
@jhendersonHDF jhendersonHDF dismissed stale reviews from byrnHDF and brtnfld via 9387696 July 20, 2025 20:20
@jhendersonHDF jhendersonHDF force-pushed the align_compiler_wrappers branch from eac8fbe to 9387696 Compare July 20, 2025 20:20
@jhendersonHDF jhendersonHDF marked this pull request as ready for review July 20, 2025 20:59
@jhendersonHDF jhendersonHDF requested review from brtnfld and byrnHDF July 20, 2025 20:59
@jhendersonHDF jhendersonHDF force-pushed the align_compiler_wrappers branch from 9387696 to c3eaee1 Compare July 20, 2025 21:04
Implemented missing --help/-h, -c, -echo and -shlib/-noshlib options

Added new -nohl option to avoid building and linking against
high-level HDF5 libraries if desired

Implemented adding of HDF5 installation library directory to rpath of
resulting executable/library and added new -norpath option to avoid
this behavior if desired

Added parsing of HDF5_USE_SHLIB environment variable to determine
whether to link against shared or static HDF5 libraries

Added parsing of HDF5_PKG_CONFIG_ARGS environment variable to separate
pkg-config-specific options from compiler-specific options and prevent
conflicts

Fixed several issues in pkg-config files generated by CMake

# If linking against shared HDF5 libraries, add the
# HDF5 library directory to the rpath of the executable
# if not requested not to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: if not requested not to -> unless requested not to is a more clear phrasing

@lrknox lrknox merged commit 4a12cfe into HDFGroup:develop Jul 28, 2025
77 checks passed
@github-project-automation github-project-automation bot moved this from To be triaged to Done in HDF5 - TRIAGE & TRACK Jul 28, 2025
qkoziol pushed a commit to qkoziol/hdf5 that referenced this pull request Oct 11, 2025
)

Implemented missing --help/-h, -c, -echo and -shlib/-noshlib options

Added new -nohl option to avoid building and linking against
high-level HDF5 libraries if desired

Implemented adding of HDF5 installation library directory to rpath of
resulting executable/library and added new -norpath option to avoid
this behavior if desired

Added parsing of HDF5_USE_SHLIB environment variable to determine
whether to link against shared or static HDF5 libraries

Added parsing of HDF5_PKG_CONFIG_ARGS environment variable to separate
pkg-config-specific options from compiler-specific options and prevent
conflicts
@jhendersonHDF jhendersonHDF deleted the align_compiler_wrappers branch December 8, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Build CMake files Component - Tools Command-line tools like h5dump, includes high-level tools Component - Wrappers C++, Java & Fortran wrappers

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

h5* generated CMake wrappers lack options that are present in h5* wrappers generated with Autotools.

5 participants