# linker cannot find openmp library on msys system

**URL:** https://discourse.cmake.org/t/linker-cannot-find-openmp-library-on-msys-system/8167
**Category:** Code
**Tags:** comp:mingw
**Created:** [May 19, 2023, 9:15pm UTC](https://discourse.cmake.org/t/linker-cannot-find-openmp-library-on-msys-system/8167 "2023-05-19T21:15:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bradbell](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@bradbell](https://discourse.cmake.org/u/bradbell)
#### Post date: [May 19, 2023, 9:15pm UTC](https://discourse.cmake.org/t/linker-cannot-find-openmp-library-on-msys-system/8167/1 "2023-05-19T21:15:30Z")

</div>

I am using FIND\_PACKAGE(OpenMP) on mysy2 and then linking the necessary libraries using

```
TARGET_LINK_LIBRARIES( target_name ... ${OpenMP_CXX_LIBRARIES} )

```

This works find on most systems, but on msys2 I get the following error during linking:

```
cannot find -lC:/msys64/mingw64/lib/libcomp.dll.a

```

If I use verbose makefiles to get the linker command. Then execute the linker command with all occurrences of ‘-lC:/’ changed to 'C:/`, the linker command works fine. Is this a problem with the linker command generated by cmake ?

---

<div class="post-metadata">

### Author: ![bradbell](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/e95f7d/32.png) [@bradbell](https://discourse.cmake.org/u/bradbell)
#### Post date: [June 2, 2023, 8:08pm UTC](https://discourse.cmake.org/t/linker-cannot-find-openmp-library-on-msys-system/8167/2 "2023-06-02T20:08:22Z")

</div>

This was a problem with the version of cmake;see  
[https://gitlab.kitware.com/cmake/cmake/-/issues/24949](https://gitlab.kitware.com/cmake/cmake/-/issues/24949)
