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

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-expanding 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:

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…