I'm trying to use libjpeg in my C++ project that's built using CMake on macOS. Here are the steps I took to try and use it.
$ brew install libjpeg
In CMakeLists.txt
find_package (jpeg REQUIRED)
target_link_libraries(my_project libjpeg)
In main.cpp
#include <jpeglib.h>
To build
$ cmake -Bbuild -G Xcode .
When I build and run on Xcode, I get the error jpeglib.h file not found
.
I have verified that this file exists in /usr/local/include
.
Thanks for any help!
EDIT: This is clearly not a duplicate of the linked question, as we are dealing with two completely different build systems. I'm not using gcc
directly and instead using cmake
. This is specifically a cmake
issue.