1e649f75aSMark NunbergCMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
265f0bf6cSMark NunbergPROJECT(subjson)
33230d9c2SMark NunbergSET(SUBJSON_GTEST ${PROJECT_SOURCE_DIR}/contrib/gtest)
4e649f75aSMark NunbergINCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
5e649f75aSMark Nunberg
6790b10aeSDave RigbyINCLUDE(CTest)
7790b10aeSDave Rigby
8134f4d37STrond Norbyeif (COUCHBASE_SERVER_BUILD)
9134f4d37STrond Norbye   INCLUDE_DIRECTORIES(AFTER ${Platform_SOURCE_DIR}/include)
10134f4d37STrond Norbye   ADD_DEFINITIONS(-DCOUCHBASE_BUILD)
11790b10aeSDave Rigby   ENABLE_CODE_COVERAGE_REPORT()
12134f4d37STrond Norbye   SET(EXTRA_LIBS platform)
13134f4d37STrond Norbyeelse(COUCHBASE_SERVER_BUILD)
14134f4d37STrond Norbye   SET(EXTRA_LIBS "")
15134f4d37STrond Norbyeendif(COUCHBASE_SERVER_BUILD)
16134f4d37STrond Norbye
17c54bfcd0SMark Nunbergif((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
18c54bfcd0SMark Nunberg    AND NOT COUCHBASE_SERVER_BUILD)
19f1fbd307SMark Nunberg    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic")
20a2dbce5aSMark Nunbergendif()
21a2dbce5aSMark Nunberg
2265f0bf6cSMark NunbergSET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
2365f0bf6cSMark NunbergSET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
2465f0bf6cSMark NunbergIF(WIN32)
2565f0bf6cSMark Nunberg    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
2665f0bf6cSMark Nunberg    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
2765f0bf6cSMark NunbergELSE()
2865f0bf6cSMark Nunberg    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
2965f0bf6cSMark NunbergENDIF()
3065f0bf6cSMark Nunberg
31d33340bbSMark NunbergSET(SUBJSON_SRC subdoc/match.cc subdoc/operations.cc subdoc/path.cc
32d33340bbSMark Nunberg    subdoc/util.cc)
33e649f75aSMark NunbergADD_LIBRARY(subjson ${SUBJSON_SRC})
34134f4d37STrond NorbyeTARGET_LINK_LIBRARIES(subjson ${EXTRA_LIBS})
358593b9a5SMark NunbergADD_EXECUTABLE(bench bench.cc contrib/cliopts/cliopts.c)
368593b9a5SMark NunbergTARGET_LINK_LIBRARIES(bench subjson)
37e649f75aSMark Nunberg
38cfb22925SDave RigbyIF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})
39cfb22925SDave Rigby  ENABLE_TESTING()
40cfb22925SDave Rigby  ADD_SUBDIRECTORY(tests)
41cfb22925SDave RigbyENDIF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})
42