Debian Codegraph @

src/cdogs/yajl/CMakeLists.txt

raw
1 # Copyright (c) 2007-2014, Lloyd Hilaiel <[email protected]>
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 (YAJL_MAJOR 2)
16 set (YAJL_MINOR 1)
17 set (YAJL_MICRO 1)
18
19 set (SRCS yajl.c yajl_lex.c yajl_parser.c yajl_buf.c
20 yajl_encode.c yajl_gen.c yajl_alloc.c
21 yajl_tree.c yajl_version.c
22 )
23 set (HDRS yajl_parser.h yajl_lex.h yajl_buf.h yajl_encode.h yajl_alloc.h)
24 set (PUB_HDRS api/yajl_parse.h api/yajl_gen.h api/yajl_common.h api/yajl_tree.h)
25
26 # useful when fixing lexer bugs.
27 #add_definitions(-DYAJL_LEXER_DEBUG)
28
29 # Ensure defined when building YAJL (as opposed to using it from
30 # another project). Used to ensure correct function export when
31 # building win32 DLL.
32 add_definitions(-DYAJL_BUILD)
33
34 # set up some paths
35 set (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
36 set (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl)
37 set (shareDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/share/pkgconfig)
38
39 # set the output path for libraries
40 set(LIBRARY_OUTPUT_PATH ${libDir})
41
42 add_library(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
43
44 add_library(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
45
46 #### setup shared library version number
47 set_target_properties(yajl PROPERTIES
48 DEFINE_SYMBOL YAJL_SHARED
49 SOVERSION ${YAJL_MAJOR}
50 VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO})
51
52 #### ensure a .dylib has correct absolute installation paths upon installation
53 if(APPLE)
54 set_target_properties(yajl PROPERTIES
55 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
56 endif()
57
58 #### build up an sdk as a post build step
59
60 # create some directories
61 file(MAKE_DIRECTORY ${libDir})
62 file(MAKE_DIRECTORY ${incDir})
63
64 # generate build-time source
65 set(dollar $)
66 configure_file(api/yajl_version.h.cmake ${incDir}/yajl_version.h)
67 configure_file(yajl.pc.cmake ${shareDir}/yajl.pc)
68
69 # copy public headers to output directory
70 foreach (header ${PUB_HDRS})
71 set (header ${CMAKE_CURRENT_SOURCE_DIR}/${header})
72
73 exec_program(${CMAKE_COMMAND} ARGS -E copy_if_different ${header} ${incDir})
74
75 add_custom_command(TARGET yajl_s POST_BUILD
76 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir})
77 endforeach ()
78
79 include_directories(${incDir}/..)
80