更新时间:2022-12-07 11:07:11
如果您的应用程序与 GLUT兼容,并且它不使用freeglut的任何扩展名,那么搜索 GLUT
而不是 FREEGLUT
:
If your application is GLUT-compatible, that it doesn't use any extension of freeglut, then it is better to search GLUT
instead of FREEGLUT
:
find_package(GLUT REQUIRED)
此命令所使用的查找"脚本已经包含在CMake发行版中,并且它也搜索freeglut.
"Find" script used by this command is already shipped into CMake distro, and it searches freeglut too.
(请注意,包含目录和链接库的命令变量分别是 GLUT_INCLUDE_DIR
和 GLUT_LIBRARY
).
(Note, that with that command variables for include directories and linking libraries are GLUT_INCLUDE_DIR
and GLUT_LIBRARY
correspondingly).
如果您的应用程序需要完全免费的胶粘剂(也就是说,使用其某些扩展名与其他GLUT实现不兼容),则需要打包strong>和 FindFREEGLUT.cmake
脚本并相应地调整 CMAKE_MODULE_PATH 变量:
If your application requires exactly freeglut (that is, uses some of its extensions incompatible with other GLUT implementations), you need to ship your package with FindFREEGLUT.cmake
script and adjust CMAKE_MODULE_PATH variable correspondingly:
# Assuming you have <source-dir>/cmake/FindFREEGLUT.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(FREEGLUT REQUIRED)
You may find existing script in the net, or write it by yourself, like here.
无论如何,如果您将freeglut安装在非系统位置,则需要向CMake提示.例如,通过调整 CMAKE_PREFIX_PATH .
In any case, if you have freeglut installed into non-system location, you need to hint CMake about that. E.g., by adjusting CMAKE_PREFIX_PATH.