|
1 | 1 | ################################################################################ |
2 | 2 | # fmtlib/fmt |
| 3 | +set(fmt_export_set) |
3 | 4 | set(export_set_details) |
4 | 5 | set(install_fmt OFF) |
5 | 6 | if(NOT BUILD_SHARED_LIBS AND NVBench_ENABLE_INSTALL_RULES) |
6 | | - set(export_set_details BUILD_EXPORT_SET nvbench-targets |
7 | | - INSTALL_EXPORT_SET nvbench-targets) |
| 7 | + set(fmt_export_set nvbench-targets) |
| 8 | + set(export_set_details BUILD_EXPORT_SET ${fmt_export_set} |
| 9 | + INSTALL_EXPORT_SET ${fmt_export_set}) |
8 | 10 | set(install_fmt ON) |
9 | 11 | endif() |
10 | 12 |
|
11 | | -rapids_cpm_find(fmt 12.2.0 ${export_set_details} |
12 | | - CPM_ARGS |
13 | | - GIT_REPOSITORY "https://github.com/fmtlib/fmt.git" |
14 | | - GIT_TAG "12.2.0" |
15 | | - OPTIONS |
16 | | - # Force static to keep fmt internal. |
17 | | - "BUILD_SHARED_LIBS OFF" |
18 | | - # Suppress warnings from fmt headers by marking them as system. |
19 | | - "FMT_SYSTEM_HEADERS ON" |
20 | | - # Disable install rules since we're linking statically. |
21 | | - "FMT_INSTALL ${install_fmt}" |
22 | | - "CMAKE_POSITION_INDEPENDENT_CODE ON" |
23 | | -) |
24 | | - |
25 | | -if(NOT fmt_ADDED) |
| 13 | +# fmt may already be provided by the enclosing project |
| 14 | +if(TARGET fmt::fmt) |
| 15 | + message(STATUS "NVBench: using externally provided fmt ${fmt_VERSION}") |
26 | 16 | set(fmt_is_external TRUE) |
| 17 | + if(fmt_export_set) |
| 18 | + include("${rapids-cmake-dir}/export/package.cmake") |
| 19 | + rapids_export_package(BUILD fmt ${fmt_export_set}) |
| 20 | + rapids_export_package(INSTALL fmt ${fmt_export_set}) |
| 21 | + endif() |
| 22 | +else() |
| 23 | + rapids_cpm_find(fmt 12.2.0 ${export_set_details} |
| 24 | + CPM_ARGS |
| 25 | + GIT_REPOSITORY "https://github.com/fmtlib/fmt.git" |
| 26 | + GIT_TAG "12.2.0" |
| 27 | + OPTIONS |
| 28 | + # Force static to keep fmt internal. |
| 29 | + "BUILD_SHARED_LIBS OFF" |
| 30 | + # Suppress warnings from fmt headers by marking them as system. |
| 31 | + "FMT_SYSTEM_HEADERS ON" |
| 32 | + # Disable install rules since we're linking statically. |
| 33 | + "FMT_INSTALL ${install_fmt}" |
| 34 | + "CMAKE_POSITION_INDEPENDENT_CODE ON" |
| 35 | + ) |
| 36 | + |
| 37 | + if(NOT fmt_ADDED) |
| 38 | + set(fmt_is_external TRUE) |
| 39 | + endif() |
27 | 40 | endif() |
28 | 41 |
|
29 | 42 | ################################################################################ |
|
0 commit comments