35 lines
1,012 B
CMake
35 lines
1,012 B
CMake
cmake_minimum_required(VERSION 3.24)
|
|
project(clay C)
|
|
|
|
set(CMAKE_C_STANDARD 17)
|
|
|
|
|
|
# todo: use FetchContent instead https://cmake.org/cmake/help/latest/module/FetchContent.html#examples
|
|
find_package(PkgConfig)
|
|
pkg_check_modules(PC_CAIRO QUIET cairo)
|
|
|
|
find_path(CAIRO_INCLUDE_DIRS
|
|
NAMES cairo.h
|
|
HINTS ${PC_CAIRO_INCLUDEDIR}
|
|
${PC_CAIRO_INCLUDE_DIRS}
|
|
PATH_SUFFIXES cairo
|
|
)
|
|
|
|
find_library(CAIRO_LIBRARIES
|
|
NAMES cairo
|
|
HINTS ${PC_CAIRO_LIBDIR}
|
|
${PC_CAIRO_LIBRARY_DIRS}
|
|
)
|
|
|
|
|
|
add_library(clay src/clay.c src/clay-base.c src/clay-context.c src/clay-layout.c src/clay-property.c src/clay-text.c
|
|
src/clay-flex.c src/clay-document.c src/clay-color.c)
|
|
target_include_directories(clay PUBLIC include)
|
|
target_include_directories(clay PRIVATE ${CAIRO_INCLUDE_DIRS})
|
|
target_link_libraries(clay PRIVATE ${CAIRO_LIBRARIES})
|
|
target_compile_options(clay PRIVATE -Wall -Werror)
|
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
add_executable(clay-demo src/demo.c)
|
|
target_link_libraries(clay-demo PRIVATE clay)
|
|
endif() |