PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/cmake/FindJsonCpp.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 60 lines | 38 code | 9 blank | 13 comment | 0 complexity | c4f6e299c96ddfc932d46e39bc1db04a MD5 | raw file
 1# -*- cmake -*-
 2
 3# - Find JSONCpp
 4# Find the JSONCpp includes and library
 5# This module defines
 6#  JSONCPP_INCLUDE_DIR, where to find json.h, etc.
 7#  JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
 8#  JSONCPP_FOUND, If false, do not try to use jsoncpp.
 9#  also defined, but not for general use are
10#  JSONCPP_LIBRARY, where to find the jsoncpp library.
11
12FIND_PATH(JSONCPP_INCLUDE_DIR jsoncpp/json.h
13/usr/local/include
14/usr/include
15)
16
17# Get the GCC compiler version
18EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
19            ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
20            OUTPUT_VARIABLE _gcc_COMPILER_VERSION
21            OUTPUT_STRIP_TRAILING_WHITESPACE
22            )
23
24# Try to find a library that was compiled with the same compiler version as we currently use.
25SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
26IF (STANDALONE)
27    # On standalone, assume that the system installed library was compiled with the used compiler.
28    SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so)
29ENDIF (STANDALONE)
30FIND_LIBRARY(JSONCPP_LIBRARY
31  NAMES ${JSONCPP_NAMES}
32  PATHS /usr/lib /usr/local/lib
33  )
34
35IF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
36    SET(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
37    SET(JSONCPP_FOUND "YES")
38ELSE (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
39  SET(JSONCPP_FOUND "NO")
40ENDIF (JSONCPP_LIBRARY AND JSONCPP_INCLUDE_DIR)
41
42
43IF (JSONCPP_FOUND)
44   IF (NOT JSONCPP_FIND_QUIETLY)
45      MESSAGE(STATUS "Found JSONCpp: ${JSONCPP_LIBRARIES}")
46   ENDIF (NOT JSONCPP_FIND_QUIETLY)
47ELSE (JSONCPP_FOUND)
48   IF (JSONCPP_FIND_REQUIRED)
49      MESSAGE(FATAL_ERROR "Could not find JSONCpp library")
50   ENDIF (JSONCPP_FIND_REQUIRED)
51ENDIF (JSONCPP_FOUND)
52
53# Deprecated declarations.
54SET (NATIVE_JSONCPP_INCLUDE_PATH ${JSONCPP_INCLUDE_DIR} )
55GET_FILENAME_COMPONENT (NATIVE_JSONCPP_LIB_PATH ${JSONCPP_LIBRARY} PATH)
56
57MARK_AS_ADVANCED(
58  JSONCPP_LIBRARY
59  JSONCPP_INCLUDE_DIR
60  )