CMake FetchContent SDL2未安装

时间:2018-11-21 22:48:20

标签: c++ cmake sdl-2

我正在尝试使用CMake的FetchContent获取SDL2。构建成功完成,但是当我尝试安装时出现错误:

[build] Makefile:117: recipe for target 'install' failed
[build] CMake Error at _deps/sdl2-build/cmake_install.cmake:198 (file):
[build]   file INSTALL cannot find
[build]   "/home/brian/Develop/onion-engine/build/_deps/sdl2-build/libSDL2.so".
[build] Call Stack (most recent call first):
[build]   cmake_install.cmake:171 (include)

这是执行提取的代码片段:

FetchContent_Declare(
    SDL2
    URL ${SDL_URI}
    URL_HASH MD5=${SDL_HASH}
)    

FetchContent_GetProperties(SDL2)
if(NOT sdl2_POPULATED)
    FetchContent_Populate(SDL2)

    message(STATUS "Source dir: ${sdl2_SOURCE_DIR}")
    message(STATUS "Binary dir: ${sdl2_BINARY_DIR}")
    add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR})
    target_link_libraries(myCode SDL2)
endif()

常见问题解答:

  1. 您为什么不使用find_package(SDL2)?

我想为用户下载依赖项。

0 个答案:

没有答案