]> git.cworth.org Git - apitrace/blob - cmake/FindQJSON.cmake
Add FindQJSON.cmake.
[apitrace] / cmake / FindQJSON.cmake
1 # Find QJSON - JSON handling library for Qt
2 #
3 # This module defines
4 #  QJSON_FOUND - whether the qsjon library was found
5 #  QJSON_LIBRARIES - the qjson library
6 #  QJSON_INCLUDE_DIR - the include path of the qjson library
7 #
8
9 if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
10
11   # Already in cache
12   set (QJSON_FOUND TRUE)
13
14 else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
15
16   if (NOT WIN32)
17     # use pkg-config to get the values of QJSON_INCLUDE_DIRS
18     # and QJSON_LIBRARY_DIRS to add as hints to the find commands.
19     include (FindPkgConfig)
20     pkg_check_modules (QJSON REQUIRED QJson>=0.5)
21   endif (NOT WIN32)
22
23   find_library (QJSON_LIBRARIES
24     NAMES
25     qjson
26     PATHS
27     ${QJSON_LIBRARY_DIRS}
28     ${LIB_INSTALL_DIR}
29     ${KDE4_LIB_DIR}
30   )
31
32   find_path (QJSON_INCLUDE_DIR
33     NAMES
34     parser.h
35     PATH_SUFFIXES
36     qjson
37     PATHS
38     ${QJSON_INCLUDE_DIRS}
39     ${INCLUDE_INSTALL_DIR}
40     ${KDE4_INCLUDE_DIR}
41   )
42
43   include(FindPackageHandleStandardArgs)
44   find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR)
45
46 endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)