summaryrefslogtreecommitdiff
path: root/externals/find-modules/Findfmt.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'externals/find-modules/Findfmt.cmake')
-rw-r--r--externals/find-modules/Findfmt.cmake43
1 files changed, 43 insertions, 0 deletions
diff --git a/externals/find-modules/Findfmt.cmake b/externals/find-modules/Findfmt.cmake
new file mode 100644
index 000000000..e0a04a344
--- /dev/null
+++ b/externals/find-modules/Findfmt.cmake
@@ -0,0 +1,43 @@
1
2find_package(PkgConfig QUIET)
3pkg_check_modules(PC_fmt QUIET fmt)
4
5find_path(fmt_INCLUDE_DIR
6 NAMES format.h
7 PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt}
8 PATH_SUFFIXES fmt
9)
10
11find_library(fmt_LIBRARY
12 NAMES fmt
13 PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
14)
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(fmt
18 FOUND_VAR fmt_FOUND
19 REQUIRED_VARS
20 fmt_LIBRARY
21 fmt_INCLUDE_DIR
22 VERSION_VAR fmt_VERSION
23)
24
25if(fmt_FOUND)
26 set(fmt_LIBRARIES ${fmt_LIBRARY})
27 set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
28 set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER})
29endif()
30
31if(fmt_FOUND AND NOT TARGET fmt::fmt)
32 add_library(fmt::fmt UNKNOWN IMPORTED)
33 set_target_properties(fmt::fmt PROPERTIES
34 IMPORTED_LOCATION "${fmt_LIBRARY}"
35 INTERFACE_COMPILE_OPTIONS "${PC_fmt_CFLAGS_OTHER}"
36 INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
37 )
38endif()
39
40mark_as_advanced(
41 fmt_INCLUDE_DIR
42 fmt_LIBRARY
43)