【发布时间】:2019-08-10 23:48:03
【问题描述】:
我正在尝试在我的 C++ 项目中使用 libjpeg,该项目是在 macOS 上使用 CMake 构建的。以下是我尝试使用它的步骤。
$ brew install libjpeg
在CMakeLists.txt
find_package (jpeg REQUIRED)
target_link_libraries(my_project libjpeg)
在main.cpp
#include <jpeglib.h>
构建
$ cmake -Bbuild -G Xcode .
当我在 Xcode 上构建和运行时,我收到错误 jpeglib.h file not found。
我已验证此文件存在于/usr/local/include。
感谢您的帮助!
编辑:这显然不是链接问题的副本,因为我们正在处理两个完全不同的构建系统。我没有直接使用gcc,而是使用cmake。这具体是一个cmake 问题。
【问题讨论】:
-
cmake 是否找到
jpeg?