# Problem in static link of HDF5+OpenMP w/ Intel ifx; \`search\_static\` limited only to GNU toolchain?

**URL:** <https://discourse.cmake.org/t/problem-in-static-link-of-hdf5-openmp-w-intel-ifx-search-static-limited-only-to-gnu-toolchain/15486>\
**Category:** Code\
**Created:** [January 30, 2026, 2:06am UTC](https://discourse.cmake.org/t/problem-in-static-link-of-hdf5-openmp-w-intel-ifx-search-static-limited-only-to-gnu-toolchain/15486 "2026-01-30T02:06:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KazuFurutaka](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/0ea827/32.png) [@KazuFurutaka](https://discourse.cmake.org/u/KazuFurutaka)\
**Post date:** [January 30, 2026, 2:06am UTC](https://discourse.cmake.org/t/problem-in-static-link-of-hdf5-openmp-w-intel-ifx-search-static-limited-only-to-gnu-toolchain/15486/1 "2026-01-30T02:06:55Z")

</div>

Dear experienced CMake coders!

I’m novice in writing CMake scripts…

Now I’m writng a `CMakeLists . txt` for a Fortran project with HDF5, MPI and OpenMP options (either shared and statically linked). The Fortran compilers in main use are GNU gfortran and Intel ifx.

And I’m having a difficulty in doing static linking with Intel ifx (which contains both MPI and OpenMP as internal libraries):

- Either one of the libraries (HDF5, MPI, or OpenMP) can be statically linked
- In cases of HDF5+MPI and OpenMP+MPI, they can be statically linked, but
- For HDF5+OpenMP(+MPI), some intel libraries (e.g. libirng) remain as shared libraries, even though the options `-static-intel -static-libgcc` are passed in `CMAKE_EXE_LINKER_FLAGS`.

Could some give me some suggestions on the cause of the problem and how to correct the issue?

By `--trace-expand`ing the CMake configuration process of a simple Fortran program which uses both HDF5 and OpenMP, I noticed lines with`-Bstatic -lirng -Bdynamic`, but the library seems not to be processed as a static library:

 ![Screenshot From 2026-01-30 11-04-46](https://discourse.cmake.org/uploads/default/original/2X/8/874316d127c4489b55dc41c27007a0eeac04d60a.png)

It seems to me that the match for `search_static` is limited to GNU ones (`gfortran`,`quadmath`, `stdc++`). Is my observation correct? If so, isn’t it insufficient? Is it related to the problem above?

The version of CMake I use is 3.31.10 (on Fedora linux).

Thanks in advance.

Kazuyoshi

p.s. I attached the fragment of trace as an image to avoid "An error occurred: Sorry, new users can only put 2 links in a post.” error…
