diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d296bd7a5f..33078816f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,7 @@ jobs: runs-on: ubuntu-24.04 env: CXX_STANDARD: '17' + CMAKE_VERSION: '3.14.0' BUILD_TYPE: 'Debug' steps: - name: Harden the runner (Audit all outbound calls) @@ -70,6 +71,7 @@ jobs: - name: setup run: | sudo -E ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh - name: install dependencies run: | sudo -E apt-get update diff --git a/cmake/nlohmann-json.cmake b/cmake/nlohmann-json.cmake index e441826e97..14e375e9c9 100644 --- a/cmake/nlohmann-json.cmake +++ b/cmake/nlohmann-json.cmake @@ -35,8 +35,9 @@ if(NOT nlohmann_json_FOUND) # Set the nlohmann_json_VERSION variable from the git tag. string(REGEX REPLACE "^v([0-9]+\\.[0-9]+\\.[0-9]+)$" "\\1" nlohmann_json_VERSION "${nlohmann-json_GIT_TAG}") - #Disable iwyu and clang-tidy - if(TARGET nlohmann_json) + # Disable iwyu and clang-tidy only if the CMake version is greater or equal to 3.19. + # CMake 3.19+ is needed to set the iwyu and clang-tidy properties on the INTERFACE target + if(TARGET nlohmann_json AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19") set_target_properties(nlohmann_json PROPERTIES CXX_INCLUDE_WHAT_YOU_USE "" CXX_CLANG_TIDY "") endif()