How do I check for SDL2_ttf in CMakeLists.txt?

和自甴很熟 提交于 2020-01-13 19:55:10

问题


I am currently writing an SDL2 program with the SDL2-ttf library and wanted to add a check for it in CMakeLists.txt. How do I do that?

I am using CMake 3.1.


回答1:


FindSDL_ttf.cmake is part of cmake 3.x just use

find_package(SDL_ttf REQUIRED)



回答2:


The FindSDL_ttf doesn't work with SDL2, so you'll have to use a third party option.

I've used this and it works: https://raw.githubusercontent.com/Deraen/ohj2710/master/cmake_modules/FindSDL2TTF.cmake

Just put it in a directory included by set(CMAKE_MODULE_PATH /path/to/file)

and then use it find_package(SDL2TTF)



来源:https://stackoverflow.com/questions/29056249/how-do-i-check-for-sdl2-ttf-in-cmakelists-txt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!