aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindPlist.cmake
diff options
context:
space:
mode:
authorfuzzard <fuzzard@kodi.tv>2023-09-05 15:44:57 +1000
committerfuzzard <fuzzard@kodi.tv>2023-09-05 18:04:03 +1000
commit1cf173748b122278aecb9222b3f517d501d084b4 (patch)
tree99d56f5b60ac769240fc71b20066877e7ca53745 /cmake/modules/FindPlist.cmake
parenta56bb0a0064b57b5dfefbb5e3e2047266396d9fc (diff)
[cmake] FindPlist migrate to full TARGET usage
Diffstat (limited to 'cmake/modules/FindPlist.cmake')
-rw-r--r--cmake/modules/FindPlist.cmake54
1 files changed, 21 insertions, 33 deletions
diff --git a/cmake/modules/FindPlist.cmake b/cmake/modules/FindPlist.cmake
index 8f9b2d6cd7..368b6758d5 100644
--- a/cmake/modules/FindPlist.cmake
+++ b/cmake/modules/FindPlist.cmake
@@ -3,49 +3,37 @@
# ---------
# Finds the Plist library
#
-# This will define the following variables::
+# This will define the following target:
#
-# PLIST_FOUND - system has Plist library
-# PLIST_INCLUDE_DIRS - the Plist library include directory
-# PLIST_LIBRARIES - the Plist libraries
-# PLIST_DEFINITIONS - the Plist compile definitions
-#
-# and the following imported targets::
-#
-# Plist::Plist - The Plist library
-
-if(PKG_CONFIG_FOUND)
- pkg_search_module(PC_PLIST libplist-2.0 libplist QUIET)
-endif()
+# Plist::Plist - The Plist library
-find_path(PLIST_INCLUDE_DIR plist/plist.h
- PATHS ${PC_PLIST_INCLUDEDIR})
+if(NOT TARGET Plist::Plist)
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_search_module(PC_PLIST libplist-2.0 libplist QUIET)
+ endif()
-set(PLIST_VERSION ${PC_PLIST_VERSION})
+ find_path(PLIST_INCLUDE_DIR plist/plist.h
+ PATHS ${PC_PLIST_INCLUDEDIR}
+ NO_CACHE)
-find_library(PLIST_LIBRARY NAMES plist-2.0 plist libplist-2.0 libplist
- PATHS ${PC_PLIST_LIBDIR})
+ set(PLIST_VERSION ${PC_PLIST_VERSION})
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Plist
- REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
- VERSION_VAR PLIST_VERSION)
+ find_library(PLIST_LIBRARY NAMES plist-2.0 plist libplist-2.0 libplist
+ PATHS ${PC_PLIST_LIBDIR}
+ NO_CACHE)
-if(PLIST_FOUND)
- set(PLIST_LIBRARIES ${PLIST_LIBRARY})
- set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR})
- set(PLIST_DEFINITIONS -DHAS_AIRPLAY=1)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Plist
+ REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
+ VERSION_VAR PLIST_VERSION)
- if(NOT TARGET Plist::Plist)
+ if(PLIST_FOUND)
add_library(Plist::Plist UNKNOWN IMPORTED)
- if(PLIST_LIBRARY)
- set_target_properties(Plist::Plist PROPERTIES
- IMPORTED_LOCATION "${PLIST_LIBRARY}")
- endif()
set_target_properties(Plist::Plist PROPERTIES
+ IMPORTED_LOCATION "${PLIST_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS HAS_AIRPLAY=1)
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP Plist::Plist)
endif()
endif()
-
-mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY)