summaryrefslogtreecommitdiffstats
path: root/project/cmake/modules/FindPlist.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/modules/FindPlist.cmake')
-rw-r--r--project/cmake/modules/FindPlist.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/project/cmake/modules/FindPlist.cmake b/project/cmake/modules/FindPlist.cmake
new file mode 100644
index 0000000..d7a6c48
--- /dev/null
+++ b/project/cmake/modules/FindPlist.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindPlist
3# ---------
4# Finds the Plist library
5#
6# This will will define the following variables::
7#
8# PLIST_FOUND - system has Plist library
9# PLIST_INCLUDE_DIRS - the Plist library include directory
10# PLIST_LIBRARIES - the Plist libraries
11# PLIST_DEFINITIONS - the Plist compile definitions
12#
13# and the following imported targets::
14#
15# Plist::Plist - The Plist library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_PLIST libplist QUIET)
19endif()
20
21find_path(PLIST_INCLUDE_DIR plist/plist.h
22 PATHS ${PC_PLIST_INCLUDEDIR})
23
24set(PLIST_VERSION ${PC_PLIST_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(PLIST_LIBRARY NAMES plist
29 PATHS ${PC_PLIST_LIBDIR})
30
31 find_package_handle_standard_args(PLIST
32 REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
33 VERSION_VAR PLIST_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(PLIST
37 REQUIRED_VARS PLIST_INCLUDE_DIR
38 VERSION_VAR PLIST_VERSION)
39endif()
40
41if(PLIST_FOUND)
42 set(PLIST_LIBRARIES ${PLIST_LIBRARY})
43 set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR})
44 set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1)
45
46 if(NOT TARGET Plist::Plist)
47 add_library(Plist::Plist UNKNOWN IMPORTED)
48 if(PLIST_LIBRARY)
49 set_target_properties(Plist::Plist PROPERTIES
50 IMPORTED_LOCATION "${PLIST_LIBRARY}")
51 endif()
52 set_target_properties(Plist::Plist PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1)
55 endif()
56endif()
57
58mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY)