File: CMakeLists.txt

package info (click to toggle)
avro-c 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,868 kB
  • sloc: ansic: 25,752; sh: 114; makefile: 8; cpp: 7
file content (150 lines) | stat: -rw-r--r-- 3,971 bytes parent folder | download | duplicates (2)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

include(GNUInstallDirs)

set(AVRO_SRC
    allocation.c
    array.c
    avro.h
    avro/allocation.h
    avro/basics.h
    avro/consumer.h
    avro/data.h
    avro/errors.h
    avro/generic.h
    avro/io.h
    avro/legacy.h
    avro/refcount.h
    avro/resolver.h
    avro/schema.h
    avro/value.h
    avro_generic_internal.h
    avro_private.h
    codec.c
    codec.h
    consumer.c
    consume-binary.c
    datafile.c
    datum.c
    datum.h
    datum_equal.c
    datum_read.c
    datum_size.c
    datum_skip.c
    datum_validate.c
    datum_value.c
    datum_write.c
    dump.c
    dump.h
    encoding.h
    encoding_binary.c
    errors.c
    generic.c
    io.c
    map.c
    memoize.c
    resolved-reader.c
    resolved-writer.c
    resolver.c
    schema.c
    schema.h
    schema_equal.c
    st.c
    st.h
    string.c
    value.c
    value-hash.c
    value-json.c
    value-read.c
    value-sizeof.c
    value-write.c
    wrapped-buffer.c
)


source_group(Avro FILES ${AVRO_SRC})

# The version.sh script gives us a VERSION that uses colon as a
# separator; we need periods.

string(REPLACE ":" "." LIBAVRO_DOT_VERSION ${LIBAVRO_VERSION})

add_library(avro-static STATIC ${AVRO_SRC})
target_link_libraries(avro-static ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES})
set_target_properties(avro-static PROPERTIES OUTPUT_NAME avro)

if (NOT WIN32)
# TODO: Create Windows DLLs. See http://www.cmake.org/Wiki/BuildingWinDLL
add_library(avro-shared SHARED ${AVRO_SRC})
target_link_libraries(avro-shared ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES})
set_target_properties(avro-shared PROPERTIES
        OUTPUT_NAME avro
        VERSION ${LIBAVRO_DOT_VERSION}
        SOVERSION ${LIBAVRO_SOVERSION})
endif(NOT WIN32)

install(FILES
        ${CMAKE_CURRENT_SOURCE_DIR}/avro.h
        DESTINATION include)
install(DIRECTORY
        ${CMAKE_CURRENT_SOURCE_DIR}/avro
        DESTINATION include
        FILES_MATCHING PATTERN "*.h")

if (WIN32)
install(TARGETS avro-static
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
       )
else(WIN32)
install(TARGETS avro-static avro-shared
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
        ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
       )
endif(WIN32)

# Install pkg-config file

set(prefix ${CMAKE_INSTALL_PREFIX})
set(VERSION ${AVRO_VERSION})
configure_file(avro-c.pc.in avro-c.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/avro-c.pc
        DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

add_executable(avrocat avrocat.c)
target_link_libraries(avrocat avro-shared)
install(TARGETS avrocat RUNTIME DESTINATION bin)

add_executable(avroappend avroappend.c)
target_link_libraries(avroappend avro-shared)
install(TARGETS avroappend RUNTIME DESTINATION bin)

if (NOT WIN32)
#TODO: Port getopt() to Windows to compile avropipe.c and avromod.c
add_executable(avropipe avropipe.c)
target_link_libraries(avropipe avro-shared)
install(TARGETS avropipe RUNTIME DESTINATION bin)

add_executable(avromod avromod.c)
target_link_libraries(avromod avro-shared)
install(TARGETS avromod RUNTIME DESTINATION bin)
endif(NOT WIN32)