无法在cmake中使用find_package找到Lua标头
我正在尝试使用 CMake 为我使用 Lua 的项目构建生成 make 文件。当我运行 make 时,出现此错误:
/path/to/my/project/luaudio/luaudio.c:1:17: fatal error: lua.h: No such file or directory
在 CMakeLists.txt 文件中,我有以下几行,我认为可以做到这一点,但显然它们还不够:
find_package(Lua51 REQUIRED)
set(Luaudio_INCLUDE_DIRS ${Luaudio_SOURCE_DIR} ${Lua51_INCLUDE_DIRS} PARENT_SCOPE)
include_directories(${Luaudio_INCLUDE_DIRS})
Lua51_Include_Dirs 似乎是空的(尝试通过消息运行它)命令不打印任何内容)所以我怀疑它只是找不到它。我需要指定在哪里寻找Lua吗?我的印象是 find_package 的全部要点是它会在一组预定义的位置中查找,这样我就不需要指定它的具体位置。
(这是在 Ubuntu 机器上,我确实安装了 Lua 软件包。)
I'm trying to use CMake to build generate the make file for a project of mine that uses Lua. When I run make I get this error:
/path/to/my/project/luaudio/luaudio.c:1:17: fatal error: lua.h: No such file or directory
In the CMakeLists.txt file, I have the following lines, which I thought would do it, but apparently they're not enough:
find_package(Lua51 REQUIRED)
set(Luaudio_INCLUDE_DIRS ${Luaudio_SOURCE_DIR} ${Lua51_INCLUDE_DIRS} PARENT_SCOPE)
include_directories(${Luaudio_INCLUDE_DIRS})
Lua51_Include_Dirs appears to be empty (attempting to run it though the message command doesn't print anything) so I suspect that it just can't find it. Do I need to specify where to look for Lua? I was under the impression that the whole point of find_package was that it would look in a set a predefined places so that I don't need to specify where it is specifically.
(This is on an Ubuntu machine and I do have the Lua packages installed.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
安装lua bin:
安装lua lib:
install lua bin:
install lua lib:
从 cmake 2.8 探索
FindLua51.cmake
我发现它设置了LUA_INCLUDE_DIR
变量而不是Lua51_INCLUDE_DIRS
。所以cmake代码应该是Exploring
FindLua51.cmake
from cmake 2.8 I found that it setsLUA_INCLUDE_DIR
variable instead ofLua51_INCLUDE_DIRS
. So cmake code should be适用于 Ubuntu 14.04
for Ubuntu 14.04