FindOpenMP missing link dirs to search
It seems FindOpenMP is trying to compile some test source codes for each language and parse the verbose output from compiler using cmake_parse_implicit_link_info
, then input OpenMP_${LANG}_IMPLICIT_LINK_DIRS
as HINTS
to find_library
with NO_DEFAULT_PATH
enabled (ref: !1481 (merged)).
This means the link dirs used to search OpenMP libraries are directly parsed from -Lxxxx
args, which are passed from compiler to linker, but gcc may filter out -L/lib
and -L/usr/lib
in LIBRARY_PATH
(ref: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=bb07cc244e30fbeccc701816db888f497d65eb08;hb=HEAD#l7931), assuming the linker will search these directories by default.
Thus CMake may think openmp could not be found. This can be reproduced on platforms without extra -L
args passed by default (riscv64, arm32, etc.).
Should FindOpenMP append /lib
and /usr/lib
to the link dirs? Or should cmake_parse_implicit_link_info
add these paths by default?