Skip to content

Commit fe65ca0

Browse files
committed
don't build bundled libfmt, we use it in header-only mode anyway
1 parent 6777c67 commit fe65ca0

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

cmake/libfmt.cmake

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,29 @@ SET(WITH_LIBFMT "auto" CACHE STRING
77
MACRO(BUNDLE_LIBFMT)
88
SET(dir "${CMAKE_BINARY_DIR}/extra/libfmt")
99
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})
1310

1411
ExternalProject_Add(
1512
libfmt
1613
PREFIX "${dir}"
1714
URL "https://github.com/fmtlib/fmt/archive/refs/tags/8.0.1.zip"
1815
URL_MD5 e77873199e897ca9f780479ad68e25b1
1916
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
3420
)
35-
SET_TARGET_PROPERTIES(fmt PROPERTIES EXCLUDE_FROM_ALL TRUE)
3621
ENDMACRO()
3722

3823
MACRO (CHECK_LIBFMT)
3924
IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto")
40-
SET(CMAKE_REQUIRED_LIBRARIES fmt)
4125
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>
4329
#include <iostream>
4430
int main() {
4531
std::cout << fmt::format(\"The answer is {}.\", 42);
4632
}" HAVE_SYSTEM_LIBFMT)
47-
SET(CMAKE_REQUIRED_LIBRARIES)
4833
ENDIF()
4934
IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled")
5035
IF (WITH_LIBFMT STREQUAL "system")

libmysqld/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ IF(NOT DISABLE_SHARED)
396396
# libmysqld
397397
SET_TARGET_PROPERTIES(libmysqld PROPERTIES CLEAN_DIRECT_OUTPUT 1)
398398
SET_TARGET_PROPERTIES(mysqlserver PROPERTIES CLEAN_DIRECT_OUTPUT 1)
399-
TARGET_LINK_LIBRARIES(mysqlserver LINK_PRIVATE tpool fmt ${CRC32_LIBRARY})
399+
TARGET_LINK_LIBRARIES(mysqlserver LINK_PRIVATE tpool ${CRC32_LIBRARY})
400400
IF(LIBMYSQLD_SO_EXTRA_LIBS)
401401
TARGET_LINK_LIBRARIES(libmysqld LINK_PRIVATE ${LIBMYSQLD_SO_EXTRA_LIBS})
402402
ENDIF()

sql/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ MAYBE_DISABLE_IPO(sql)
208208
DTRACE_INSTRUMENT(sql)
209209
TARGET_LINK_LIBRARIES(sql
210210
mysys mysys_ssl dbug strings vio pcre2-8
211-
tpool fmt
211+
tpool
212212
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
213213
${SSL_LIBRARIES}
214214
${LIBSYSTEMD})
@@ -391,6 +391,10 @@ ADD_CUSTOM_TARGET(
391391
${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.cc
392392
)
393393

394+
IF(TARGET libfmt)
395+
ADD_DEPENDENCIES(GenServerSource libfmt)
396+
ENDIF()
397+
394398
IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
395399
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
396400
SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "")

0 commit comments

Comments
 (0)