CMake无法找到已安装的库

时间:2013-09-06 05:20:31

标签: cmake directfb

运行CMake时出现以下问题。

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DIRECTFB_INCLUDE_DIR (ADVANCED)
  used as include directory in directory /u/menie482/workspace/AtariTEXPLORE
  used as include directory in directory /u/menie482/workspace/AtariTEXPLORE/rl_common
  used as include directory in directory /u/menie482/workspace/AtariTEXPLORE/rl_agent
  used as include directory in directory /u/menie482/workspace/AtariTEXPLORE/rl_env
DIRECTFB_LIBRARY (ADVANCED)
  linked by target "experiment" in directory /u/menie482/workspace/AtariTEXPLORE

实际上,我已经检查过运行

时已经安装了DirectFB
locate libdirectfb

那么,我该怎么办才能让CMake知道DIrectFB在哪里?一个不方便的限制是我不能在这台机器上做sudo ..

谢谢!

1 个答案:

答案 0 :(得分:0)

我想,您正在尝试在CMakeLists.txt文件中使用类似find_package(directfb)的内容。只有拥有/usr/share/cmake/Modules/directfb.cmake(Ubuntu 12.04)才能运行。

我的第二个猜测是你在CMakeLists.txt文件中使用类似pkg_module(directfb)的东西。只有在某处有directfb.pc时才能运行。

否则
你在哪里设置变量DIRECTFB_INCLUDE_DIR和DIRECTFB_LIBRARY。

作为替代步骤,请尝试使用find_library()。您必须提供libdirectfb.so的确切路径并执行类似

的操作
  

find_library(DIRECT_FB NAMES directfb PATHS path / directfb.so)
    target_link_libraries(MyLibraryOrMyExecutable $ {DIRECT_FB})