diff options
Diffstat (limited to 'externals/find-modules/Findfmt.cmake')
| -rw-r--r-- | externals/find-modules/Findfmt.cmake | 43 |
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 | |||
| 2 | find_package(PkgConfig QUIET) | ||
| 3 | pkg_check_modules(PC_fmt QUIET fmt) | ||
| 4 | |||
| 5 | find_path(fmt_INCLUDE_DIR | ||
| 6 | NAMES format.h | ||
| 7 | PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt} | ||
| 8 | PATH_SUFFIXES fmt | ||
| 9 | ) | ||
| 10 | |||
| 11 | find_library(fmt_LIBRARY | ||
| 12 | NAMES fmt | ||
| 13 | PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt} | ||
| 14 | ) | ||
| 15 | |||
| 16 | include(FindPackageHandleStandardArgs) | ||
| 17 | find_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 | |||
| 25 | if(fmt_FOUND) | ||
| 26 | set(fmt_LIBRARIES ${fmt_LIBRARY}) | ||
| 27 | set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR}) | ||
| 28 | set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER}) | ||
| 29 | endif() | ||
| 30 | |||
| 31 | if(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 | ) | ||
| 38 | endif() | ||
| 39 | |||
| 40 | mark_as_advanced( | ||
| 41 | fmt_INCLUDE_DIR | ||
| 42 | fmt_LIBRARY | ||
| 43 | ) | ||