[Bug 223678] devel/cmake: find_package(OpenMP) doesn't find the openmp package (when base clang compiler is used)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 10 13:20:19 GMT 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223678

--- Comment #22 from Adriaan de Groot <adridg at freebsd.org> ---
Yuri, here's a patched-up FindOpenMP.cmake (and the diff between the one
included with cmake-3.13.3 and the patch-up version). It basically hits things
with a hammer again until stuff works.

 - When checking for OpenMP support, we still need to add the right include
paths for <omp.h>, and then linking paths for libopenmp (assuming devel/openmp
is installed, not the one from an llvm port).
 - If a port Makefile messes around with CXXFLAGS and LDFLAGS (e.g. adding
LOCALBASE) then this would work, but for a "bare" compile, those directories
are not searched.

So this patch does:
 - Hammer the necessary -I and -L flags into try_compile()
 - Hammer them into the exported link target ("Modern" style). This causes
warnings about -L flags in compile lines, though.

It gets your test-case from PR 234050 to build and run in a 12.0-R VM, with no
extra environment manipulation. It is, however, rather ugly (especially the way
it adds flags to the exported targets). Can you test this against the bits you
have? Just replace /usr/local/share/cmake/Modules/FindOpenMP.cmake .

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the kde-freebsd mailing list