Blame view

FindJsoncpp.cmake 1.9 KB
772ec5a4   Peter M. Groen   Added cmake envir...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  # Locate jsoncpp
  #
  # This module defines
  #  JSONCPP_FOUND, if false, do not try to link to jsoncpp
  #  JSONCPP_LIBRARY, where to find jsoncpp
  #  JSONCPP_INCLUDE_DIR, where to find json.h
  #
  # By default, the dynamic libraries of jsoncpp will be found. To find the static ones instead,
  # you must set the JSONCPP_STATIC_LIBRARY variable to TRUE before calling find_package(Jsoncpp ...).
  #
  # If jsoncpp is not installed in a standard path, you can use the JSONCPP_DIR CMake variable
  # to tell CMake where jsoncpp is.
  
  set(JSONCPP_FOUND 0)
  
  # attempt to find static library first if this is set
  if(JSONCPP_STATIC_LIBRARY)
      set(JSONCPP_STATIC libjsoncpp.a)
  endif()
  
  # find the jsoncpp include directory
  find_path(JSONCPP_INCLUDE_DIR json/json.h
            PATHS
            ~/Library/Frameworks/jsoncpp/include/
            /Library/Frameworks/jsoncpp/include/
            /usr/local/include/
            /usr/include/
            /sw/jsoncpp/         # Fink
            /opt/local/jsoncpp/  # DarwinPorts
            /opt/csw/jsoncpp/    # Blastwave
            /opt/jsoncpp/
            ${JSONCPP_DIR}/include/
            PATH_SUFFIXES jsoncpp)
  
  # find the jsoncpp library
  find_library(JSONCPP_LIBRARY
               NAMES ${JSONCPP_STATIC} jsoncpp
               PATH_SUFFIXES lib64 lib
               PATHS ~/Library/Frameworks
                      /Library/Frameworks
                      /usr/local
                      /usr
                      /sw
                      /opt/local
                      /opt/csw
                      /opt
                      ${JSONCPP_DIR}/lib)
  
  # handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE if all listed variables are TRUE
  include(FindPackageHandleStandardArgs)
  FIND_PACKAGE_HANDLE_STANDARD_ARGS(JSONCPP DEFAULT_MSG JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
  mark_as_advanced(JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
  message("JSONCPP_FOUND = ${JSONCPP_FOUND}, includedir = ${JSONCPP_INCLUDE_DIR}, lib = ${JSONCPP_LIBRARY}")