diff options
-rw-r--r-- | cmake/modules/FindPlist.cmake | 54 | ||||
-rw-r--r-- | xbmc/network/CMakeLists.txt | 2 |
2 files changed, 22 insertions, 34 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) diff --git a/xbmc/network/CMakeLists.txt b/xbmc/network/CMakeLists.txt index 400e151615..d6560e6d3d 100644 --- a/xbmc/network/CMakeLists.txt +++ b/xbmc/network/CMakeLists.txt @@ -31,7 +31,7 @@ if(ENABLE_OPTICAL) list(APPEND HEADERS cddb.h) endif() -if(PLIST_FOUND) +if(TARGET Plist::Plist) list(APPEND SOURCES AirPlayServer.cpp) list(APPEND HEADERS AirPlayServer.h) endif() |