ugfx/cmake/Findugfx.cmake

52 lines
1.0 KiB
CMake
Raw Normal View History

2021-10-27 14:45:20 +00:00
# Define UGFX_ROOT
set(UGFX_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
2021-10-12 15:44:54 +00:00
# Ensure that CHIBIOS_ROOT is set
if(NOT UGFX_ROOT)
message(FATAL_ERROR "No UGFX_ROOT specified")
endif()
# Assemble list of components
list(APPEND ugfx_COMPONENTS
gadc
gaudio
gdisp
gdriver
gevent
gfile
ginput
gmisc
gos
gqueue
gtimer
gtrans
gwin
)
# Core sources
list(APPEND ugfx_SOURCES
${UGFX_ROOT}/src/gfx.c
)
# Core include directories
list(APPEND ugfx_INCLUDE_DIRS
${UGFX_ROOT}
2021-10-12 15:44:54 +00:00
${UGFX_ROOT}/src
)
# Include each component
foreach(component ${ugfx_COMPONENTS})
include(${UGFX_ROOT}/src/${component}/${component}.cmake)
endforeach()
# Include target setup for ease-of-use
include(${CMAKE_CURRENT_LIST_DIR}/target_setup.cmake)
# Remove duplicates from non-cached variables
list(REMOVE_DUPLICATES ugfx_SOURCES)
list(REMOVE_DUPLICATES ugfx_INCLUDE_DIRS)
# Outsource heavy-lifting to cmake
include(FindPackageHandleStandardArgs)
2021-11-03 19:23:29 +00:00
find_package_handle_standard_args(ugfx DEFAULT_MSG UGFX_ROOT ugfx_SOURCES ugfx_INCLUDE_DIRS)