diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eb55e94..f28e901c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,13 @@ option(freetype-gl_BUILD_HARFBUZZ "Build the freetype-gl harfbuzz support (exper option(freetype-gl_BUILD_MAKEFONT "Build the makefont tool" ON) option(freetype-gl_BUILD_TESTS "Build the tests" ON) +if(${freetype-gl_BUILD_TESTS}) + find_package(ImageMagick QUIET COMPONENTS compare) + if(NOT ${ImageMagick_EXECUTABLE_DIR}) + message(FATAL_ERROR "ImageMagick was not found. Either provide path to ImageMagick, or disable freetype-gl_BUILD_TESTS option.") + endif() +endif() + include(RequireIncludeFile) include(RequireFunctionExists) include(CheckLibraryExists) @@ -63,11 +70,10 @@ check_symbol_exists(M_PI math.h HAVE_M_PI) if(NOT HAVE_M_PI) list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_USE_MATH_DEFINES) - unset(HAVE_M_PI CACHE) - check_symbol_exists(M_PI math.h HAVE_M_PI) + check_symbol_exists(M_PI math.h HAVE_M_PI2) - if(NOT HAVE_M_PI) + if(NOT HAVE_M_PI2) message(FATAL_ERROR "`M_PI` not defined in `math.h`.") else() add_definitions(-D_USE_MATH_DEFINES) diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 5d55646c..f99460ee 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -54,27 +54,29 @@ target_include_directories(demo-utils PUBLIC $ ) -add_custom_command( - DEPENDS - makefont - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - COMMAND - ../$<$:$(Configuration)/>makefont - ARGS - --font fonts/Vera.ttf - --header ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h - --size 16 - --variable font - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h -) +if(freetype-gl_BUILD_MAKEFONT) + add_custom_command( + DEPENDS + makefont + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + COMMAND + ../$<$:$(Configuration)/>makefont + ARGS + --font fonts/Vera.ttf + --header ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h + --size 16 + --variable font + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h + ) -add_custom_target(generate-embedded-font - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h -) + add_custom_target(generate-embedded-font + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vera-16.h + ) -create_demo(embedded-font embedded-font.c) -add_dependencies(embedded-font generate-embedded-font) + create_demo(embedded-font embedded-font.c) + add_dependencies(embedded-font generate-embedded-font) +endif() create_demo(texture texture.c) create_demo(font font.c)