]> granicus.if.org Git - icinga2/blob - third-party/yajl/src/CMakeLists.txt
Replace cJSON with YAJL
[icinga2] / third-party / yajl / src / CMakeLists.txt
1 # Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
2 #
3 # Permission to use, copy, modify, and/or distribute this software for any
4 # purpose with or without fee is hereby granted, provided that the above
5 # copyright notice and this permission notice appear in all copies.
6 #
7 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
15 SET (SRCS yajl.c yajl_lex.c yajl_parser.c yajl_buf.c
16           yajl_encode.c yajl_gen.c yajl_alloc.c
17           yajl_tree.c yajl_version.c
18 )
19 SET (HDRS yajl_parser.h yajl_lex.h yajl_buf.h yajl_encode.h yajl_alloc.h)
20 SET (PUB_HDRS api/yajl_parse.h api/yajl_gen.h api/yajl_common.h api/yajl_tree.h)
21
22 # useful when fixing lexer bugs.
23 #ADD_DEFINITIONS(-DYAJL_LEXER_DEBUG)
24
25 # Ensure defined when building YAJL (as opposed to using it from
26 # another project).  Used to ensure correct function export when
27 # building win32 DLL.
28 ADD_DEFINITIONS(-DYAJL_BUILD)
29
30 # set up some paths
31 SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl)
32
33 ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
34
35 #### setup shared library version number
36 SET_TARGET_PROPERTIES(yajl PROPERTIES
37                       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
38                       DEFINE_SYMBOL YAJL_SHARED
39                       SOVERSION ${YAJL_MAJOR}
40                       VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}
41                                           FOLDER Lib)
42
43 #### build up an sdk as a post build step
44
45 # create some directories
46 FILE(MAKE_DIRECTORY ${incDir})
47
48 # generate build-time source
49 CONFIGURE_FILE(api/yajl_version.h.cmake ${incDir}/yajl_version.h)
50
51 # copy public headers to output directory
52 FOREACH (header ${PUB_HDRS})
53   SET (header "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
54
55   EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different \"${header}\" \"${incDir}\")
56 ENDFOREACH (header ${PUB_HDRS})
57
58 INCLUDE_DIRECTORIES(${incDir}/..)
59
60 INSTALL(TARGETS yajl
61   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
62   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/icinga2)