diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 65e5c423ebc..b90e964eebb 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -407,6 +407,42 @@ jobs: run: | cmake --build cmake.output.boost -- -j$(nproc) + build_cmake_minimum: # TODO: move to docker workflow? + + runs-on: ubuntu-22.04 # use the oldest available runner + + env: + CMAKE_VERSION: 3.22 + CMAKE_VERSION_FULL: 3.22.6 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install missing software + run: | + sudo apt-get update + sudo apt-get install libxml2-utils + # qt6-tools-dev-tools for lprodump + # qt6-l10n-tools for lupdate + sudo apt-get install qt6-base-dev libqt6charts6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libglx-dev libgl1-mesa-dev + + - name: Install CMake + run: | + wget https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz + tar xf cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64.tar.gz + + - name: Run CMake (without GUI) + run: | + export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTING=On + + - name: Run CMake (with GUI) + run: | + export PATH=cmake-${{ env.CMAKE_VERSION_FULL }}-linux-x86_64/bin:$PATH + cmake -S . -B cmake.output.gui -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On + build: strategy: diff --git a/.github/workflows/CI-windows.yml b/.github/workflows/CI-windows.yml index d8f2bc7e4d9..da5fe2df99e 100644 --- a/.github/workflows/CI-windows.yml +++ b/.github/workflows/CI-windows.yml @@ -98,6 +98,48 @@ jobs: run: | cmake --build build.cxxstd --config Debug || exit /b !errorlevel! + build_cmake_minimum: + + runs-on: windows-2022 # use the oldest available runner + + env: + CMAKE_VERSION: 3.22 + CMAKE_VERSION_FULL: 3.22.6 + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install CMake + run: | + curl -fsSL https://cmake.org/files/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64.zip -o cmake.zip || exit /b !errorlevel! + 7z x cmake.zip || exit /b !errorlevel! + + - name: Set up Visual Studio environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: 6.10.0 + modules: 'qtcharts' + setup-python: 'false' + cache: true + aqtversion: '==3.1.*' # TODO: remove when aqtinstall 3.2.2 is available + + - name: Run CMake (without GUI) + run: | + :: TODO: enable DHAVE_RULES? + cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On + + - name: Run CMake (with GUI) + run: | + :: TODO: enable DHAVE_RULES? + cmake-${{ env.CMAKE_VERSION_FULL }}-windows-x86_64\bin\cmake.exe -S . -B cmake.output.gui -G "Visual Studio 17 2022" -A x64 -DHAVE_RULES=Off -DBUILD_TESTING=On -DBUILD_GUI=On -DWITH_QCHART=On -DBUILD_TRIAGE=On + build: strategy: matrix: diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f603ae1332..e41d81029ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.22) project(Cppcheck VERSION 2.18.99 LANGUAGES CXX) include(cmake/options.cmake) diff --git a/cmake/options.cmake b/cmake/options.cmake index 0e8da0e3f0b..4a315667093 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -124,14 +124,10 @@ option(ENABLE_CSA_ALPHA "Enable Clang Static Analyzer alpha checkers for run # TODO: disable by default like make build? option(FILESDIR "Hard-coded directory for files to load from" OFF) -if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16") - set(CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers") - # need to disable the prologue or it will be treated like a system header and not emit any warnings - # see https://gitlab.kitware.com/cmake/cmake/-/issues/21219 - set(CMAKE_PCH_PROLOGUE "") -else() - set(CMAKE_DISABLE_PRECOMPILE_HEADERS On CACHE BOOL "Disable precompiled headers") -endif() +set(CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers") +# need to disable the prologue or it will be treated like a system header and not emit any warnings +# see https://gitlab.kitware.com/cmake/cmake/-/issues/21219 +set(CMAKE_PCH_PROLOGUE "") set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Output directory for headers") set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "Output directory for libraries") diff --git a/readme.md b/readme.md index 246d2e07c72..9244243770a 100644 --- a/readme.md +++ b/readme.md @@ -52,7 +52,7 @@ The minimum required Python version is 3.7. ### CMake -The minimum required version is CMake 3.13. +The minimum required version is CMake 3.22. Example, compiling Cppcheck with cmake: diff --git a/releasenotes.txt b/releasenotes.txt index 4772418f1f0..fe530b2121e 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -23,4 +23,5 @@ Infrastructure & dependencies: Other: - The built-in "win*" and "unix*" platforms will now default to signed char type instead of unknown signedness. If you require unsigned chars please specify "--funsigned-char" +- bumped minimum required CMake version to 3.22 -