微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 如何设置CMake搜索路径

在我的CMakeLists.txt中

include (CheckFunctionExists.cmake)

当我运行ccmake时(我正在关注官方tutorial)

CMake Error at CMakeLists.txt:10 (include):
   include Could not find load file:

     CheckFunctionExists.cmake

但是,我有指定的文件

sw3@pc90313-sw3:~/learn_cmake/build$find / -name CheckFunctionExists.cmake 2>/dev/null
/usr/share/cmake-2.8/Modules/CheckFunctionExists.cmake

我正在使用Ubuntu 13.04存储库的cmake安装:

sw3@pc90313-sw3:~/learn_cmake/build$cmake --version
cmake version 2.8.10.1

如果指定了绝对路径,那么一切都运行良好,并生成一个工作的makefile.但是,这种解决方法远非理想(并且与教程不同).问题出在哪里?

解决方法

该路径称为${CMAKE_ROOT}.所以系统文件的正确include命令是

include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)

,在本教程后面提到.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐