我使用了https://github.com/brendan-w/collector/tree/master/cmake中的.cmake
文件,并将它们放在与我的CMakeLists.txt相同的目录中,然后我使用了以下代码:
set(CMAKE_MODULE_PATH FindSDL2.cmake FindSDL2_image.cmake)
find_package(SDL2 REQUIRED)
但是我收到了错误提示:
CMake Error at CMakeLists.txt:26 (find_package):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.
Could not find a package configuration file provided by "SDL2" with any of
the following names:
SDL2Config.cmake
sdl2-config.cmake
Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
"SDL2_DIR" to a directory containing one of the above files. If "SDL2"
provides a separate development package or SDK, be sure it has been
installed.
CMAKE_MODULE_PATH
是一个目录,包含模块,而不是模块列表本身。 - Tsyvarev