[all-commits] [llvm/llvm-project] bab8af: [OpenMP] Only include CMAKE_DL_LIBS on unix platforms

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Aug 9 04:34:41 PDT 2022

  Branch: refs/heads/release/15.x
  Home:   https://github.com/llvm/llvm-project
  Commit: bab8af8ea062f6332b5c5d13ae688bb8900f244a
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-08-09 (Tue, 09 Aug 2022)

  Changed paths:
    M openmp/runtime/src/CMakeLists.txt

  Log Message:
  [OpenMP] Only include CMAKE_DL_LIBS on unix platforms

CMAKE_DL_LIBS is documented as "Name of library containing dlopen
and dlclose".

On Windows platforms, there's no system provided dlopen/dlclose, but
it can be argued that if you really intend to call dlopen/dlclose,
you're going to be using a third party compat library like
https://github.com/dlfcn-win32/dlfcn-win32, and CMAKE_DL_LIBS should
expand to its name.

This has been argued upstream in CMake in
https://gitlab.kitware.com/cmake/cmake/-/issues/17600 and
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1642, that
CMAKE_DL_LIBS should expand to "dl" on mingw platforms.

The merge request wasn't merged though, as it caused some amount of
breakage, but in practice, Fedora still carries a custom CMake patch
with the same effect.

Thus, this patch fixes cross compiling OpenMP for mingw targets
on Fedora with their custom-patched CMake.

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

(cherry picked from commit 7f24fd26a8abaef2fa4561aa399adde81d9c563a)

More information about the All-commits mailing list