If font is not found, just don't build example instead of failing

This commit is contained in:
Dmitry Marakasov 2014-12-28 03:50:22 +03:00
parent 3570d812eb
commit ffc2caf14d

View File

@ -35,12 +35,13 @@ IF(SDL2PP_WITH_TTF)
ttf-bitstream-vera
)
ENDIF(NOT SDL2PP_EXAMPLE_FONT)
IF(SDL2PP_EXAMPLE_FONT)
MESSAGE(STATUS "Using example font: ${SDL2PP_EXAMPLE_FONT}")
ADD_DEFINITIONS(-DEXAMPLE_FONT="${SDL2PP_EXAMPLE_FONT}")
ADD_EXECUTABLE(ttf ttf.cc)
TARGET_LINK_LIBRARIES(ttf SDL2pp)
ELSE(SDL2PP_EXAMPLE_FONT)
MESSAGE(FATAL_ERROR "Cannot find font to use with ttf example (Vera.ttf). You need to either install it, add path to it into examples/CMakeLists.txt (and submit this chnage upstream) or specify path (to any .ttf file) manually with SDL2PP_EXAMPLE_FONT variable")
MESSAGE(WARNING "Cannot find font to use with ttf example (Vera.ttf), ttf example will not be built.\nYou need to install the font if it's not installed, else you may need to either add path to the font into list in examples/CMakeLists.txt or manually specify path to any .ttf file with SDL2PP_EXAMPLE_FONT CMake variable")
ENDIF(SDL2PP_EXAMPLE_FONT)
ADD_DEFINITIONS(-DEXAMPLE_FONT="${SDL2PP_EXAMPLE_FONT}")
ADD_EXECUTABLE(ttf ttf.cc)
TARGET_LINK_LIBRARIES(ttf SDL2pp)
ENDIF(SDL2PP_WITH_TTF)