aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authormontellese <montellese@kodi.tv>2016-11-05 10:13:44 +0100
committermontellese <montellese@kodi.tv>2017-03-05 12:44:58 +0100
commitf67df251141bfbed8bfe249ba2c3f0add6cc4629 (patch)
treed30eb2e2c3d9be6609f2f1b630d069a097d77f30 /cmake
parent2bbf02ddfaf2dfe2583b70ec4e38d6bfe5b00504 (diff)
[cmake/depends/win32] add libfmt
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindFmt.cmake46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake
new file mode 100644
index 0000000000..78ad7132f3
--- /dev/null
+++ b/cmake/modules/FindFmt.cmake
@@ -0,0 +1,46 @@
+# FindFmt
+# -------
+# Finds the Fmt library
+#
+# This will define the following variables::
+#
+# FMT_FOUND - system has Fmt
+# FMT_INCLUDE_DIRS - the Fmt include directory
+# FMT_LIBRARIES - the Fmt libraries
+#
+# and the following imported targets::
+#
+# Fmt::Fmt - The Fmt library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FMT libfmt QUIET)
+endif()
+
+find_path(FMT_INCLUDE_DIR NAMES fmt/format.h
+ PATHS ${PC_FMT_INCLUDEDIR})
+
+find_library(FMT_LIBRARY_RELEASE NAMES fmt
+ PATHS ${PC_FMT_LIBDIR})
+find_library(FMT_LIBRARY_DEBUG NAMES fmtd
+ PATHS ${PC_FMT_LIBDIR})
+
+include(SelectLibraryConfigurations)
+select_library_configurations(FMT)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Fmt
+ REQUIRED_VARS FMT_LIBRARY FMT_INCLUDE_DIR)
+
+if(FMT_FOUND)
+ set(FMT_LIBRARIES ${FMT_LIBRARY})
+ set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR})
+
+ if(NOT TARGET Fmt::Fmt)
+ add_library(Fmt::Fmt UNKNOWN IMPORTED)
+ set_target_properties(Fmt::Fmt PROPERTIES
+ IMPORTED_LOCATION "${FMT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)