Details
-
Task
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
3.4.8
Description
cmake_minimum_required is already 3.12 but several constructs date back to cmake 2.x.
1. Policy loop — explicitly set CMP0003/0022/0023/0057/0069/0075 to NEW, all of which default to NEW with 3.12. Only CMP0077 (NEW since 3.13) still needs an explicit set.
2. NAMELINK_COMPONENT — replace the two-INSTALL NAMELINK_SKIP/NAMELINK_ONLY workaround with the single-INSTALL form (available since 3.12). The comment says "CentOS 7 cmake 2.8.12".
3. ADD_DEFINITIONS -> add_compile_definitions — the modern form (since 3.12) doesn't require the -D prefix. One call that misused ADD_DEFINITIONS for a compiler flag (-Wno-deprecated-declarations) is corrected to add_compile_options.
4. Dead version check — cmake/misc.cmake had a VERSION_LESS "2.8.7" branch, unreachable with minimum 3.12.
5. CMAKE_COMPILER_IS_GNUCC — deprecated since cmake 2.6, replaced with CMAKE_C_COMPILER_ID MATCHES "GNU" (already used elsewhere in the same file).
6. Old-style ENDIF(condition)/ELSE(condition) — bare ENDIF()/ELSE() is the modern form. Six cmake files in cmake/ and top-level CMakeLists.txt.
7. INCLUDE(FindXXX) -> FIND_PACKAGE(XXX) — FIND_PACKAGE is the standard invocation. Affected: FindCURL, FindGit.
8. Dead cmake version checks — plugins.cmake had a VERSION_LESS 2.8.11 branch falling back to include_directories(); libmariadb/CMakeLists.txt had a VERSION_GREATER 2.8.7 guard around OBJECT library creation. Both always true/false with minimum 3.12.
9. MSVC_VERSION > 1310 guards — WindowsCache.cmake guarded strnlen/vsnprintf/strtok_s behind MSVC > 1310 (VS .NET 2003). Always true — cmake 3.12 doesn't support any MSVC older than VS 2015 (1900), and the guarded functions have been available since VS 2005 (1400).
https://github.com/mariadb-corporation/mariadb-connector-c/pull/306
All changes are mechanical with no semantic effect on the build. Tested on Fedora 42 and Debian 12 CI containers.