llvm-project/openmp/runtime/cmake
Dimitry Andric 956168c802 Ensure correct pthread flags and libraries are used
On most platforms, certain compiler and linker flags have to be passed
when using pthreads, otherwise linking against libomp.so might fail with
undefined references to several pthread functions.

Use CMake's `find_package(Threads)` to determine these for standalone
builds, or take them (and optionally modify them) from the top-level
LLVM cmake files.

Also, On FreeBSD, ensure that libomp.so is linked against libm.so,
similar to NetBSD.

Adjust test cases with hardcoded `-lpthread` flag to use the common
build flags, which should now have the required pthread flags.

Reviewers: emaste, jlpeyton, krytarowski, mgorny, protze.joachim, Hahnfeld

Reviewed By: Hahnfeld

Subscribers: AndreyChurbanov, tra, EricWF, Hahnfeld, jfb, jdoerfert, openmp-commits

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D59451

llvm-svn: 357618
2019-04-03 18:11:36 +00:00
..
LibompCheckFortranFlag.cmake
LibompCheckLinkerFlag.cmake
LibompDefinitions.cmake
LibompExports.cmake
LibompGetArchitecture.cmake
LibompHandleFlags.cmake Ensure correct pthread flags and libraries are used 2019-04-03 18:11:36 +00:00
LibompMicroTests.cmake Ensure correct pthread flags and libraries are used 2019-04-03 18:11:36 +00:00
LibompUtils.cmake
config-ix.cmake [OpenMP] Remove accidental commit to config-ix.cmake in r353747 2019-02-11 21:09:15 +00:00