@@ -7,44 +7,29 @@ SET(WITH_LIBFMT "auto" CACHE STRING
7
7
MACRO (BUNDLE_LIBFMT )
8
8
SET (dir "${CMAKE_BINARY_DIR} /extra/libfmt" )
9
9
SET (LIBFMT_INCLUDE_DIR "${dir} /src/libfmt/include" )
10
- ADD_LIBRARY (fmt STATIC IMPORTED GLOBAL )
11
- SET (file ${dir} /src/libfmt-build/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}fmt${CMAKE_STATIC_LIBRARY_SUFFIX} )
12
- SET_TARGET_PROPERTIES (fmt PROPERTIES IMPORTED_LOCATION ${file} )
13
10
14
11
ExternalProject_Add (
15
12
libfmt
16
13
PREFIX "${dir} "
17
14
URL "https://github.com/fmtlib/fmt/archive/refs/tags/8.0.1.zip"
18
15
URL_MD5 e77873199e897ca9f780479ad68e25b1
19
16
INSTALL_COMMAND ""
20
- CMAKE_ARGS
21
- "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
22
- "-DBUILD_SHARED_LIBS=OFF"
23
- "-DFMT_DEBUG_POSTFIX="
24
- "-DFMT_DOC=OFF"
25
- "-DFMT_TEST=OFF"
26
- "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} "
27
- "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} ${PIC_FLAG} "
28
- "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} "
29
- "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} "
30
- "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} "
31
- "-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} "
32
- "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} "
33
- BUILD_BYPRODUCTS ${file}
17
+ CONFIGURE_COMMAND ""
18
+ BUILD_COMMAND ""
19
+ BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR} /fmt/format-inl.h
34
20
)
35
- SET_TARGET_PROPERTIES (fmt PROPERTIES EXCLUDE_FROM_ALL TRUE )
36
21
ENDMACRO ()
37
22
38
23
MACRO (CHECK_LIBFMT )
39
24
IF (WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto" )
40
- SET (CMAKE_REQUIRED_LIBRARIES fmt )
41
25
CHECK_CXX_SOURCE_COMPILES (
42
- "#include <fmt/core.h>
26
+ "#define FMT_STATIC_THOUSANDS_SEPARATOR ','
27
+ #define FMT_HEADER_ONLY 1
28
+ #include <fmt/format-inl.h>
43
29
#include <iostream>
44
30
int main() {
45
31
std::cout << fmt::format(\" The answer is {}.\" , 42);
46
32
}" HAVE_SYSTEM_LIBFMT )
47
- SET (CMAKE_REQUIRED_LIBRARIES )
48
33
ENDIF ()
49
34
IF (NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled" )
50
35
IF (WITH_LIBFMT STREQUAL "system" )
0 commit comments