Open mmuetzel opened 6 months ago
That is probably due to the same issue that is mentioned here: https://discourse.cmake.org/t/openmp-linking-errors-on-windows-using-ninja-and-clang/7246
If there is no open bug report about that for CMake yet, it might make sense to create one...
A work-around for this issue until it is fixed in upstream CMake is to use clang-cl
instead of clang
and clang++
when targeting MSVC.
Is this resolved now, by using clang-cl
?
Using clang-cl
works around this issue. The issue is still there with clang
when building a msvc target.
That issue probably needs to be fixed in upstream CMake.
It might be best to keep this open until this is fixed in case someone else runs into the same issue.
See #760 for a reproducer in CI.
I opened a merge request for CMake proposing the change from #760: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9235
The change has been accepted upstream and should be part of CMake 3.29 when it will be released (unless it will be reverted for some reason before the release).
I don't know how often CMake is updated in MS Visual Studio. It is at cmake version 3.27.2-msvc1
for my Visual Studio 2022 installation. That version was tagged August 10, 2023. So, it might take a while before that fix finds its way into Visual Studio.
CMake 3.29 (for which this should be fixed) has just been released: https://cmake.org/cmake/help/v3.29/release/3.29.html
I don't know how long it will take until that version finds its way into MS Visual Studio.
In the closed issue https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/309, @chengts95 noted in the 30th comment:
Opening a separate issue so that this won't get forgotten.
The build errors like the following:
The error probably occurs because the OpenMP libraries aren't set for some reason by
FindOpenMP.cmake
:IIUC, they should be set to the same as when building with
clang-cl
: