Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-816

CMake modernization for the 3.12 baseline

    XMLWordPrintable

Details

    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.

      Attachments

        Activity

          People

            georg Georg Richter
            mschorm Michal Schorm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.