set(MODULE_NAME fonts)
message(STATUS "Checking dependencies for module: " ${MODULE_NAME})

set(fonts_LIB_DEPENDS "")

list(APPEND fonts_LIB_INCLUDES 
    FontReader.cpp
    TrueTypeFont.cpp
    FontsManager.cpp
    FontGlyph.cpp
    )
    
if(UNIX)
    find_package(Freetype QUIET)
    if(Freetype_FOUND)
        list(APPEND fonts_LIB_INCLUDES
        FreeTypeFontEngine.cpp
        )
        
        list(APPEND fonts_LIB_DEPENDS
        Freetype::Freetype
        )
        list(APPEND DEFINES "HAS_FREETYPE")   
    else()
        message(STATUS "Freetype not found - skipping support")
    endif()
endif()

add_library(${MODULE_NAME} SHARED ${fonts_LIB_INCLUDES})

target_include_directories(${MODULE_NAME} PUBLIC
                          ${CMAKE_CURRENT_SOURCE_DIR}
                          )
                          
target_link_libraries(${MODULE_NAME} PUBLIC core image ${fonts_LIB_DEPENDS})

target_compile_definitions(${MODULE_NAME} PRIVATE ${DEFINES})
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER src)
set_target_properties( ${MODULE_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )