diff options
Diffstat (limited to 'cmake/modules/FindTagLib.cmake')
| -rw-r--r-- | cmake/modules/FindTagLib.cmake | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake new file mode 100644 index 0000000..8c8c2f3 --- /dev/null +++ b/cmake/modules/FindTagLib.cmake | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindTagLib | ||
| 3 | # ---------- | ||
| 4 | # Finds the TagLib library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # TAGLIB_FOUND - system has TagLib | ||
| 9 | # TAGLIB_INCLUDE_DIRS - the TagLib include directory | ||
| 10 | # TAGLIB_LIBRARIES - the TagLib libraries | ||
| 11 | # | ||
| 12 | # and the following imported targets:: | ||
| 13 | # | ||
| 14 | # TagLib::TagLib - The TagLib library | ||
| 15 | |||
| 16 | if(PKG_CONFIG_FOUND) | ||
| 17 | pkg_check_modules(PC_TAGLIB taglib>=1.9.0 QUIET) | ||
| 18 | endif() | ||
| 19 | |||
| 20 | find_path(TAGLIB_INCLUDE_DIR taglib/tag.h | ||
| 21 | PATHS ${PC_TAGLIB_INCLUDEDIR}) | ||
| 22 | find_library(TAGLIB_LIBRARY_RELEASE NAMES tag | ||
| 23 | PATHS ${PC_TAGLIB_LIBDIR}) | ||
| 24 | find_library(TAGLIB_LIBRARY_DEBUG NAMES tagd | ||
| 25 | PATHS ${PC_TAGLIB_LIBDIR}) | ||
| 26 | set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) | ||
| 27 | |||
| 28 | include(SelectLibraryConfigurations) | ||
| 29 | select_library_configurations(TAGLIB) | ||
| 30 | |||
| 31 | include(FindPackageHandleStandardArgs) | ||
| 32 | find_package_handle_standard_args(TagLib | ||
| 33 | REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR | ||
| 34 | VERSION_VAR TAGLIB_VERSION) | ||
| 35 | |||
| 36 | if(TAGLIB_FOUND) | ||
| 37 | set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY}) | ||
| 38 | |||
| 39 | # Workaround broken .pc file | ||
| 40 | list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES}) | ||
| 41 | |||
| 42 | set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR}) | ||
| 43 | if(NOT TARGET TagLib::TagLib) | ||
| 44 | add_library(TagLib::TagLib UNKNOWN IMPORTED) | ||
| 45 | if(TAGLIB_LIBRARY_RELEASE) | ||
| 46 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 47 | IMPORTED_CONFIGURATIONS RELEASE | ||
| 48 | IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}") | ||
| 49 | endif() | ||
| 50 | if(TAGLIB_LIBRARY_DEBUG) | ||
| 51 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 52 | IMPORTED_CONFIGURATIONS DEBUG | ||
| 53 | IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}") | ||
| 54 | endif() | ||
| 55 | set_target_properties(TagLib::TagLib PROPERTIES | ||
| 56 | INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}") | ||
| 57 | endif() | ||
| 58 | endif() | ||
| 59 | |||
| 60 | mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY) | ||
