@@ -539,6 +539,18 @@ IF(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY)
539539 SET (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY OFF CACHE INTERNAL "" FORCE )
540540ENDIF ()
541541
542+ # We have our own WITH_UNIT_TESTS option, and call ENABLE_TESTING() accordingly.
543+ # We do not INCLUDE(CTest) here.
544+ # Various 3rd party libraries use this option, so set it to OFF.
545+ OPTION (BUILD_TESTING "See <cmake root>/Modules/CTest.cmake" OFF )
546+ IF (BUILD_TESTING)
547+ MESSAGE (WARNING "Do not set BUILD_TESTING to ON/TRUE, "
548+ "use the cmake option WITH_UNIT_TESTS instead."
549+ )
550+ SET (BUILD_TESTING OFF )
551+ SET (BUILD_TESTING OFF CACHE INTERNAL "" FORCE )
552+ ENDIF ()
553+
542554# Ninja only: List of available pools.
543555SET_PROPERTY (GLOBAL PROPERTY JOB_POOLS one_job=1 )
544556
@@ -1210,22 +1222,17 @@ IF(CMAKE_C_FLAGS MATCHES "-fsanitize" OR CMAKE_CXX_FLAGS MATCHES "-fsanitize")
12101222 SET (CMAKE_COMPILER_FLAG_WITH_SANITIZE 1)
12111223ENDIF ()
12121224
1213- # Older versions of ccache must be disabled: export CCACHE_DISABLE=1
1214- # See http://www.cmake.org/Wiki/CTest/Coverage
12151225OPTION (ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF )
12161226IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE )
1217- STRING_APPEND ( CMAKE_C_FLAGS
1218- " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic -DHAVE_GCOV " )
1219- STRING_APPEND (CMAKE_CXX_FLAGS
1220- " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic -DHAVE_GCOV" )
1227+ SET (GCOV_COMPILER_OPTIONS
1228+ " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic" )
1229+ STRING_APPEND (CMAKE_C_FLAGS " ${GCOV_COMPILER_OPTIONS} -DHAVE_GCOV" )
1230+ STRING_APPEND ( CMAKE_CXX_FLAGS " ${GCOV_COMPILER_OPTIONS} -DHAVE_GCOV" )
12211231 STRING_APPEND (CMAKE_C_LINK_FLAGS " -Wl,--dynamic-list-data" )
12221232 STRING_APPEND (CMAKE_CXX_LINK_FLAGS " -Wl,--dynamic-list-data" )
1223- STRING_APPEND (CMAKE_EXE_LINKER_FLAGS
1224- " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic -lgcov" )
1225- STRING_APPEND (CMAKE_SHARED_LINKER_FLAGS
1226- " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic -lgcov" )
1227- STRING_APPEND (CMAKE_MODULE_LINKER_FLAGS
1228- " -fprofile-arcs -ftest-coverage -fprofile-update=prefer-atomic -lgcov" )
1233+ STRING_APPEND (CMAKE_EXE_LINKER_FLAGS " ${GCOV_COMPILER_OPTIONS} -lgcov" )
1234+ STRING_APPEND (CMAKE_SHARED_LINKER_FLAGS " ${GCOV_COMPILER_OPTIONS} -lgcov" )
1235+ STRING_APPEND (CMAKE_MODULE_LINKER_FLAGS " ${GCOV_COMPILER_OPTIONS} -lgcov" )
12291236ENDIF ()
12301237
12311238OPTION (ENABLE_GPROF "Enable gprof (optimized, Linux builds only)" OFF )
@@ -2403,12 +2410,14 @@ IF(NOT WITHOUT_SERVER AND WITH_UNIT_TESTS)
24032410 ENDIF ()
24042411 # The mold linker and RelWithDebInfo build complains about
24052412 # the new expression in Rpl_info_values::init()
2413+ # We get stringop warnings in functions generated by protobuf.
2414+ # We get even more stringop warnings from gcc 14.2 lto-wrapper.
24062415 IF (MY_COMPILER_IS_GNU)
2407- MY_TARGET_LINK_OPTIONS (server_unittest_library
2408- " -Wno-alloc-size-larger-than" )
2409- # In functions generated by protobuf:
2410- MY_TARGET_LINK_OPTIONS ( server_unittest_library
2411- "-Wno-stringop-overflow" )
2416+ TARGET_LINK_OPTIONS (server_unittest_library PUBLIC
2417+ -Wno-alloc-size-larger-than
2418+ -Wno-stringop-overflow
2419+ -Wno-stringop-overread
2420+ )
24122421 ENDIF ()
24132422 ENDIF ()
24142423 ELSE ()
@@ -2453,6 +2462,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
24532462 ${CMAKE_BINARY_DIR} /include/mysql_version.h )
24542463CONFIGURE_FILE (${CMAKE_SOURCE_DIR} /villagesql/include/version.h.in
24552464 ${CMAKE_BINARY_DIR} /villagesql/include/version.h )
2465+ CONFIGURE_FILE (${CMAKE_SOURCE_DIR} /include/mysql_server_suffix.h.in
2466+ ${CMAKE_BINARY_DIR} /include/mysql_server_suffix.h )
24562467CONFIGURE_FILE (${CMAKE_SOURCE_DIR} /sql/sql_builtin.cc.in
24572468 ${CMAKE_BINARY_DIR} /sql/sql_builtin.cc )
24582469
0 commit comments