diff options
Diffstat (limited to 'cmake/modules/FindFmt.cmake')
| -rw-r--r-- | cmake/modules/FindFmt.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake index 5473ed5..5e47509 100644 --- a/cmake/modules/FindFmt.cmake +++ b/cmake/modules/FindFmt.cmake | |||
| @@ -12,6 +12,50 @@ | |||
| 12 | # | 12 | # |
| 13 | # Fmt::Fmt - The Fmt library | 13 | # Fmt::Fmt - The Fmt library |
| 14 | 14 | ||
| 15 | if(ENABLE_INTERNAL_FMT) | ||
| 16 | include(ExternalProject) | ||
| 17 | file(STRINGS ${CMAKE_SOURCE_DIR}/tools/depends/target/libfmt/Makefile VER REGEX "^[ ]*VERSION[ ]*=.+$") | ||
| 18 | string(REGEX REPLACE "^[ ]*VERSION[ ]*=[ ]*" "" FMT_VERSION "${VER}") | ||
| 19 | |||
| 20 | # allow user to override the download URL with a local tarball | ||
| 21 | # needed for offline build envs | ||
| 22 | if(FMT_URL) | ||
| 23 | get_filename_component(FMT_URL "${FMT_URL}" ABSOLUTE) | ||
| 24 | else() | ||
| 25 | set(FMT_URL http://mirrors.kodi.tv/build-deps/sources/fmt-${FMT_VERSION}.tar.gz) | ||
| 26 | endif() | ||
| 27 | if(VERBOSE) | ||
| 28 | message(STATUS "FMT_URL: ${FMT_URL}") | ||
| 29 | endif() | ||
| 30 | |||
| 31 | if(APPLE) | ||
| 32 | set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}") | ||
| 33 | endif() | ||
| 34 | |||
| 35 | set(FMT_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libfmt.a) | ||
| 36 | set(FMT_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) | ||
| 37 | externalproject_add(fmt | ||
| 38 | URL ${FMT_URL} | ||
| 39 | DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download | ||
| 40 | PREFIX ${CORE_BUILD_DIR}/fmt | ||
| 41 | CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 42 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} | ||
| 43 | -DFMT_DOC=OFF | ||
| 44 | -DFMT_TEST=OFF | ||
| 45 | "${EXTRA_ARGS}" | ||
| 46 | BUILD_BYPRODUCTS ${FMT_LIBRARY}) | ||
| 47 | set_target_properties(fmt PROPERTIES FOLDER "External Projects") | ||
| 48 | |||
| 49 | include(FindPackageHandleStandardArgs) | ||
| 50 | find_package_handle_standard_args(Fmt | ||
| 51 | REQUIRED_VARS FMT_LIBRARY FMT_INCLUDE_DIR | ||
| 52 | VERSION_VAR FMT_VERSION) | ||
| 53 | |||
| 54 | set(FMT_LIBRARIES ${FMT_LIBRARY}) | ||
| 55 | set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR}) | ||
| 56 | |||
| 57 | else() | ||
| 58 | |||
| 15 | if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore) | 59 | if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore) |
| 16 | # TODO: fix windows fmt package to include fmt-config.cmake and fmt-config-version.cmake | 60 | # TODO: fix windows fmt package to include fmt-config.cmake and fmt-config-version.cmake |
| 17 | set(FMT_VERSION 3.0.1) | 61 | set(FMT_VERSION 3.0.1) |
| @@ -55,3 +99,5 @@ if(FMT_FOUND) | |||
| 55 | endif() | 99 | endif() |
| 56 | 100 | ||
| 57 | mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY) | 101 | mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY) |
| 102 | |||
| 103 | endif() | ||
