summaryrefslogtreecommitdiff
path: root/libs/litehtml/src/gumbo/CMakeLists.txt
blob: cd55186a1568c69a94b9085852268d6cc6007c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
cmake_minimum_required(VERSION 3.11)

project(gumbo C)

# Soname
# MAJOR is incremented when symbols are removed or changed in an incompatible way
# MINOR is incremented when new symbols are added
set(PROJECT_MAJOR 0)
set(PROJECT_MINOR 0)

set(SOURCE_GUMBO
    attribute.c
    char_ref.c
    error.c
    parser.c
    string_buffer.c
    string_piece.c
    tag.c
    tokenizer.c
    utf8.c
    util.c
    vector.c
)

set(HEADER_GUMBO
        include/gumbo/attribute.h
        include/gumbo/char_ref.h
        include/gumbo/error.h
        include/gumbo.h
        include/gumbo/insertion_mode.h
        include/gumbo/parser.h
        include/gumbo/string_buffer.h
        include/gumbo/string_piece.h
        include/gumbo/tag_enum.h
        include/gumbo/tag_gperf.h
        include/gumbo/tag_sizes.h
        include/gumbo/tag_strings.h
        include/gumbo/token_type.h
        include/gumbo/tokenizer.h
        include/gumbo/tokenizer_states.h
        include/gumbo/utf8.h
        include/gumbo/util.h
        include/gumbo/vector.h
)

set(PROJECT_LIB_VERSION ${PROJECT_MAJOR}.${PROJECT_MINOR}.0)
set(PROJECT_SO_VERSION ${PROJECT_MAJOR})

add_library(${PROJECT_NAME} ${SOURCE_GUMBO})
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_LIB_VERSION} SOVERSION ${PROJECT_SO_VERSION})

set_target_properties(${PROJECT_NAME} PROPERTIES
    C_STANDARD 99
    PUBLIC_HEADER "${HEADER_GUMBO}"
)

if(MSVC)
    target_include_directories(${PROJECT_NAME} PRIVATE visualc/include)
endif()

# Export gumbo includes.
target_include_directories(${PROJECT_NAME} PUBLIC
    $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
    $<INSTALL_INTERFACE:include>)
target_include_directories(${PROJECT_NAME} PRIVATE include/gumbo)

# install and export
install(TARGETS ${PROJECT_NAME}
    EXPORT gumbo
    RUNTIME DESTINATION bin COMPONENT libraries
    ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT libraries
    LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT libraries
    PUBLIC_HEADER DESTINATION include/gumbo
)
install(EXPORT gumbo FILE gumboConfig.cmake DESTINATION lib${LIB_SUFFIX}/cmake/gumbo)