【发布时间】:2021-05-25 04:36:19
【问题描述】:
我刚刚通过 apt-get 安装了 libsdl2-image-dev,这是我的“dpkg -L libsdl2-image-dev”命令的结果:
$ dpkg -L libsdl2-image-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libsdl2-image-dev
/usr/share/doc/libsdl2-image-dev/copyright
/usr/share/doc/libsdl2-image-dev/examples
/usr/share/doc/libsdl2-image-dev/examples/showimage.c
/usr/include
/usr/include/SDL2
/usr/include/SDL2/SDL_image.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libSDL2_image.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/SDL2_image.pc
/usr/share/doc/libsdl2-image-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libSDL2_image.so
/usr/lib/x86_64-linux-gnu/libSDL2_image-2.0.so
但是,cmake 中的“find_package(SDL2_IMAGE REQUIRED)”抱怨:
CMake Error at CMakeLists.txt:34 (find_package):
By not providing "FindSDL2_IMAGE.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"SDL2_IMAGE", but CMake did not find one.
Could not find a package configuration file provided by "SDL2_IMAGE" with
any of the following names:
SDL2_IMAGEConfig.cmake
sdl2_image-config.cmake
Add the installation prefix of "SDL2_IMAGE" to CMAKE_PREFIX_PATH or set
"SDL2_IMAGE_DIR" to a directory containing one of the above files. If
"SDL2_IMAGE" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
有人知道怎么解决吗?谢谢!
【问题讨论】:
-
您没有错误消息中列出的任何文件(
FindSDL2_IMAGE.cmake、SDL2_IMAGEConfig.cmake或sdl2_image-config.cmake)。如果您关注that blog,那么它会告诉您文件FindSDL2_IMAGE.cmake,您必须创建该文件并使其可通过CMAKE_MODULE_PATH变量进行搜索。 -
已解决。谢谢!
标签: cmake