# iMac Catalina and cmake-3.19.3

**URL:** https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572
**Category:** Usage
**Created:** [January 19, 2021, 12:19pm UTC](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572 "2021-01-19T12:19:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![szukw000](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@szukw000](https://discourse.cmake.org/u/szukw000)
#### Post date: [January 19, 2021, 12:19pm UTC](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572/1 "2021-01-19T12:19:00Z")

</div>

I have a project that uses fltk, libjpeg and libz.

The cmake configuration file contains:

> cmake \
> 
> -DCMAKE\_BUILD\_TYPE:string=“Release” \
> 
> -DZLIB\_INCLUDE\_DIR:path=“/usr/local/include” \
> 
> -DZLIB\_LIBRARY:path=“/usr/local/lib/libz.dylib” \
> 
> -DJPEG\_LIBRARY:path=“/usr/local/lib/libjpeg.dylib” \
> 
> -DJPEG\_INCLUDE\_DIR:path=“/usr/local/include” \
> 
> …

CMakeCache.txt contains:

> JPEG\_INCLUDE\_DIR:STRING=/usr/local/include
> 
> JPEG\_LIBRARY:FILEPATH=/usr/local/lib/libjpeg.dylib
> 
> ZLIB\_INCLUDE\_DIR:STRING=/usr/local/include
> 
> ZLIB\_LIBRARY:FILEPATH=/usr/local/lib/libz.dylib

But the compilation fails:

> – Found ZLIB: /usr/local/lib/libz.dylib (found version “1.2.11”)
> 
> – JPEG\_INCLUDE\_DIR : /usr/local/include #MESSAGE in FindJPEG.cmake  
> – JPEG\_LIBRARY : /usr/local/lib/libjpeg.dylib #MESSAGE in FindJPEG.cmake  
> – Found JPEG: /usr/local/lib/libjpeg.dylib (found version “62”)
> 
> ld: library not found for -ljpeg  
> clang: error: linker command failed with exit code 1 (use -v to see invocation)

The JPEG library is compile and installed using libjpeg-turbo.

Does anybody know what is wrong or missing here?

winfried

---

<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: [January 19, 2021, 7:26pm UTC](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572/2 "2021-01-19T19:26:13Z")

</div>

What is using `-ljpeg`? CMake uses full library paths where possible, so something else must be adding that flag. Is there some more context available?

- how is jpeg linked (i.e., the `target_link_libraries` call)
- what is the link line (`ninja -v` or `make VERBOSE=1`)

---

<div class="post-metadata">

### Author: ![szukw000](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@szukw000](https://discourse.cmake.org/u/szukw000)
#### Post date: [January 22, 2021, 12:10am UTC](https://discourse.cmake.org/t/imac-catalina-and-cmake-3-19-3/2572/3 "2021-01-22T00:10:59Z")

</div>

Inspecting my CMakeLists.txt I found the reason of the bug. I used FLTK\_CONFIG\_SCRIPT to find

the necessary libraries. LINUX and WIN10 never complained.

Now I simply use FLTK\_LIBRARY:

– FLTK\_LIBRARY ==\> /usr/local/fltk14/lib64/libfltk\_images.so;/usr/local/fltk14/lib64/libfltk\_forms.so;/usr/local/fltk14/lib64/libfltk.so;/usr/lib64/libSM.so;/usr/lib64/libICE.so;/usr/lib64/libX11.so;/usr/lib64/libXext.so;/usr/lib64/libm.so

Thanks for your help.

winfried
