在OS X下的CMake警告:MACOSX_RPATH没有为以下目标指定, [英] CMake warnings under OS X: MACOSX_RPATH is not specified for the following targets

查看:5085
本文介绍了在OS X下的CMake警告:MACOSX_RPATH没有为以下目标指定,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试建立在OS X(优胜美地),它可以成功的Fedora 21下建造它采用了一堆库的基于CMake的软件。在这两方面,大开放的像升压和一些自写那些躺在/ installation_folder / lib中。我使用的CMake版本3.3.0。

I try to build a CMake-based software under OS X (Yosemite) which can be built successfully under Fedora 21. It uses a bunch of libraries. Both, big open ones like Boost and some self-written ones lying in /installation_folder/lib. I use CMake version 3.3.0.

执行后

mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/5.2.0/bin/gcc-5 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/5.2.0/bin/g++-5  -DCMAKE_MODULE_PATH=${PWD}/../external/install/share/llvm/cmake 

我得到以下警告:

I get the following warnings:

CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
--help-policy CMP0042" for policy details.  Use the cmake_policy command to
set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

ClangWrapper
Structure
WCETXML

This warning is for project developers.  Use -Wno-dev to suppress it.

本的CMakeLists.txt包含有关RPATH以下行:

The CMakeLists.txt contains the following lines regarding RPATH:

SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)

IF("${isSystemDir}" STREQUAL "-1")
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")

我只能说的是, $ {CMAKE_INSTALL_ preFIX} / lib目录确实是正确的路径,而像升压其他库正确找到。

All I can say is that ${CMAKE_INSTALL_PREFIX}/lib is indeed the correct path, and that other libraries like Boost are found correctly.

忽略警告,并在一个链接错误使build目录结果仍在进行中。

Ignoring the warnings and continuing with "make" in the build directory results in a linking error.

我阅读 CMake的维基RPATH处理文章,但我还是没能这些路径变量及其在OS X

I read the CMake Wiki RPATH handling article, but I am still not able to distinguish between these path variables and their correct use on OS X.

推荐答案

添加设置(CMAKE_MACOSX_RPATH 1)到的CMakeLists.txt,上面写的语句之前,让我们的警告消失。执行制作后的链接问题保持。这使我想起我的RPATH设置无关我的问题联系起来的假设。

Adding set(CMAKE_MACOSX_RPATH 1) into CMakeLists.txt, before the above written statements, lets the warnings disappear. The linking problem after executing make stays. This brings me to the assumption that my RPATH setup has nothing to do with my linking problem.

然而,该线程的问题得到解决。如何正确地使用内部的CMakeLists.txt的RPATH选项的解释仍然是非常欢迎!

Nevertheless, this thread's problem is solved. An explanation about the correct use of the RPATH options inside CMakeLists.txt is still very welcome!

这篇关于在OS X下的CMake警告:MACOSX_RPATH没有为以下目标指定,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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