CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
OPTION(SUBJSON_GTEST "Location of gtest (for testing)" "${PROJECT_SOURCE_DIR}/contrib/gtest")
PROJECT(subjson)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})

if(CMAKE_COMPILER_IS_GNUCXX AND NOT COUCHBASE_SERVER_BUILD)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
IF(WIN32)
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ELSE()
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
ENDIF()

FILE(GLOB SUBJSON_SRC subdoc/*.c subdoc/*.cc)
ADD_LIBRARY(subjson ${SUBJSON_SRC})
ADD_EXECUTABLE(bench bench.cc contrib/cliopts/cliopts.c)
TARGET_LINK_LIBRARIES(bench subjson)

IF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})
  ENABLE_TESTING()
  ADD_SUBDIRECTORY(tests)
ENDIF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
PROJECT(subjson)
SET(SUBJSON_GTEST ${PROJECT_SOURCE_DIR}/contrib/gtest)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})

if(CMAKE_COMPILER_IS_GNUCXX AND NOT COUCHBASE_SERVER_BUILD)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
IF(WIN32)
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ELSE()
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
ENDIF()

FILE(GLOB SUBJSON_SRC subdoc/*.c subdoc/*.cc)
ADD_LIBRARY(subjson ${SUBJSON_SRC})
ADD_EXECUTABLE(bench bench.cc contrib/cliopts/cliopts.c)
TARGET_LINK_LIBRARIES(bench subjson)

IF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})
  ENABLE_TESTING()
  ADD_SUBDIRECTORY(tests)
ENDIF(EXISTS ${SUBJSON_GTEST} OR EXISTS ${gtest_SOURCE_DIR})

Make SUBJSON_GTEST a variable rather than an OPTION
Make SUBJSON_GTEST a variable rather than an OPTION

Apparently OPTIONS only work for booleans.

Change-Id: Ifcfb32c2ff7944757b8f5185bd9904307cdde5bc
Reviewed-on: http://review.couchbase.org/50521
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
