diff options
Diffstat (limited to 'project/cmake/modules/FindPlist.cmake')
| -rw-r--r-- | project/cmake/modules/FindPlist.cmake | 58 |
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 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_PLIST libplist QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(PLIST_INCLUDE_DIR plist/plist.h | ||
| 22 | PATHS ${PC_PLIST_INCLUDEDIR}) | ||
| 23 | |||
| 24 | set(PLIST_VERSION ${PC_PLIST_VERSION}) | ||
| 25 | |||
| 26 | include(FindPackageHandleStandardArgs) | ||
| 27 | if(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) | ||
| 34 | else() | ||
| 35 | # Dynamically loaded DLL | ||
| 36 | find_package_handle_standard_args(PLIST | ||
| 37 | REQUIRED_VARS PLIST_INCLUDE_DIR | ||
| 38 | VERSION_VAR PLIST_VERSION) | ||
| 39 | endif() | ||
| 40 | |||
| 41 | if(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() | ||
| 56 | endif() | ||
| 57 | |||
| 58 | mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY) | ||
