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

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

问题描述

我试图构建一些我们的软件,这是专门为运行在Linux上的MacOS X.我们使用CMake和我安装MacPorts,所以我可以很容易地获得CMake与一些第三方库我们依赖。



现在的问题是,CMake默认情况下不会从MacPorts中查找库,所以我们的几个目标被禁用,因为它找不到



我如何指示CMake也从MacPorts寻找包含和库?

解决方案

我为添加了一个工具链文件,添加了必要的include和library路径。我希望有一些更自动的东西,但至少它解决了这个问题。



darwin.cmake

  SET(CMAKE_SYSTEM_NAME Darwin)

#添加MacPorts
INCLUDE_DIRECTORIES(/ opt / local / include)
LINK_DIRECTORIES(/ opt / local / lib)


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.

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.

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

解决方案

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天全站免登陆