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