# find\_library but can't link framework

**URL:** https://discourse.cmake.org/t/find-library-but-cant-link-framework/3954
**Category:** Usage
**Created:** [August 18, 2021, 2:07pm UTC](https://discourse.cmake.org/t/find-library-but-cant-link-framework/3954 "2021-08-18T14:07:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ChangyinN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@ChangyinN](https://discourse.cmake.org/u/ChangyinN)
#### Post date: [August 18, 2021, 2:07pm UTC](https://discourse.cmake.org/t/find-library-but-cant-link-framework/3954/1 "2021-08-18T14:07:58Z")

</div>

when i use find\_library(A NAMES a PATHS /path/to/a.framework) to find a framework A and message(status ${A}) show its full path, then I do target\_link\_libraries(program ${A}) Xcode shows an framework not found a, do somebody know that?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 22, 2021, 12:37pm UTC](https://discourse.cmake.org/t/find-library-but-cant-link-framework/3954/2 "2021-08-22T12:37:12Z")

</div>

Looking at [`FindOpenCL`](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindOpenCL.cmake#L173), it looks like you should be able to just use the found path. Could you post the actual command line and error message that you’re getting?

---

<div class="post-metadata">

### Author: ![ChangyinN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@ChangyinN](https://discourse.cmake.org/u/ChangyinN)
#### Post date: [August 25, 2021, 12:32pm UTC](https://discourse.cmake.org/t/find-library-but-cant-link-framework/3954/3 "2021-08-25T12:32:32Z")

</div>

thanks for your reply. what i did is two things，one is use find\_library to get the frameworks fullpath. the another is use target\_link\_linbraries(target ${found\_var}), because the document says when link to a full path of a framework cmake will auto add a -F and a -framework to target’s link flags. i checked the build setting and found this two flags but when I build the target I get an error of framework not found. then I use the -framework ${found\_var}/name and Xcode link currect.  
maybe the way like foundopencl works, I will try later, but I think what I did should work, or I got the wrong point
