1SET(EJSON_VERSION "0.1.0")
2SET(EJSON_PREFIX ${CMAKE_ERL_LIB_INSTALL_PREFIX}/ejson-${EJSON_VERSION})
3SET(EJSON_EBIN_PREFIX ${EJSON_PREFIX}/ebin)
4SET(EJSON_PRIV_PREFIX ${EJSON_PREFIX}/priv)
5
6CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ejson.app.in
7               ${CMAKE_CURRENT_BINARY_DIR}/ejson.app)
8
9SET(EJSON_SRC ejson.c
10              decode.c
11              encode.c
12              yajl/yajl_alloc.c
13              yajl/yajl_buf.c
14              yajl/yajl.c
15              yajl/yajl_encode.c
16              yajl/yajl_gen.c
17              yajl/yajl_lex.c
18              yajl/yajl_parser.c)
19
20INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}
21                           ${ERLANG_INCLUDE_PATH})
22
23ADD_LIBRARY(ejson MODULE ${EJSON_SRC})
24SET_TARGET_PROPERTIES(ejson PROPERTIES PREFIX "")
25TARGET_LINK_LIBRARIES(ejson ${COUCHBASE_UNRESOLVED})
26SET_TARGET_PROPERTIES(ejson PROPERTIES
27    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/priv"
28    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/priv"
29)
30
31
32
33ERL_BUILD(APPNAME "ejson_build" SOURCES ejson.erl)
34
35INSTALL(TARGETS ejson
36        DESTINATION ${EJSON_PRIV_PREFIX})
37INSTALL(FILES ${outfiles}
38              ${CMAKE_CURRENT_BINARY_DIR}/ejson.app
39        DESTINATION ${EJSON_EBIN_PREFIX})
40