如何指示 CMake 查找 MacPorts 安装的库? [英] How do I instruct CMake to look for libraries installed by MacPorts?

查看:28
本文介绍了如何指示 CMake 查找 MacPorts 安装的库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建我们的一些软件,这些软件旨在仅在 Linux 和 MacOS X 上运行.我们正在使用 CMake 并安装了 MacPorts,因此我可以轻松地获得 CMake 以及一些第三方库我们依赖.

I'm trying to build some of our software, which was designed to run solely on Linux, on MacOS X. We are using CMake and I installed MacPorts so I could easily get CMake along with some of the third party libraries that we depend on.

现在的问题是,默认情况下,CMake 似乎不会从 MacPorts 中查找库,因此我们的几个目标被禁用,因为它无法找到 /opt/local 中的所有依赖项.

Now the problem is that CMake doesn't appear to look for libraries from MacPorts by default so several of our targets are disabled as it fails to find the dependencies which are all in /opt/local.

如何指示 CMake 也从 MacPorts 中查找包含和库?

How can I instruct CMake to also look for includes and libraries from MacPorts?

推荐答案

我为Darwin"添加了一个工具链文件,它添加了必要的包含和库路径.我希望有一些更自动化的东西,但至少它解决了问题.

I added a toolchain file for "Darwin" which adds the necessary include and library paths. I was hoping for something a little more automatic but at least it solves the problem.

darwin.cmake:

SET(CMAKE_SYSTEM_NAME Darwin)

# Add MacPorts
INCLUDE_DIRECTORIES(/opt/local/include)
LINK_DIRECTORIES(/opt/local/lib)

这篇关于如何指示 CMake 查找 MacPorts 安装的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆