Commit 75047180e for clamav.net

commit 75047180ee61721e2014d3996bd1b62602c24ff3
Author: Jonas Zaddach <5988756+zaddach@users.noreply.github.com>
Date:   Wed Aug 6 18:27:06 2025 +0200

    GitHub Actions: Fix Windows workflow

    Build on windows-2022, as windows-2019 is no longer available

    Use updated vcpkg github action

    Try to use vcpkg manifest mode

    Provide vcpkg baseline commit hash

    Correctly request dependency feature

    Fix printing vcpkg triplet

    Try building with CMakePresets.json

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index 23a3a6681..065c127d1 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -18,11 +18,16 @@ on:
 env:
   # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
   BUILD_TYPE: Release
-  VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91

 jobs:
   build-windows:
-    runs-on: windows-2019
+    runs-on: windows-latest
+
+    permissions:
+      packages: write
+
+    env:
+      VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/Cisco-Talos/index.json,readwrite"

     steps:
       - name: Die, link!!!!!
@@ -44,48 +49,25 @@ jobs:
       # Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
       - name: Restore vcpkg ports from cache or install vcpkg
         # Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
-        uses: lukka/run-vcpkg@v7.4
+        uses: lukka/run-vcpkg@v11
         id: runvcpkg
-        with:
-          vcpkgArguments: "curl[openssl] openssl:x64-windows-static-md json-c libxml2 pcre2 check pthreads zlib pdcurses bzip2"
-          vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
-          vcpkgTriplet: "x64-windows"

-      - name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
+      - name: Print the VCPKG_ROOT (for debugging)
         shell: bash
-        run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
+        run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}'"

       - name: dir the VCPKG_ROOT
         run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}

-      - name: Create Build Directory
-        shell: bash
-        # Some projects don't allow in-source building, so create a separate build directory
-        # We'll use this as our working directory for all subsequent commands
-        run: cmake -E make_directory ${{runner.workspace}}/build
-
-      - name: Run CMake+Ninja with triplet (cmd)
-        uses: lukka/run-cmake@v3.4
+      - name: Run CMake+Ninja
+        uses: lukka/run-cmake@v10
         id: runcmake_cmd
         with:
-          cmakeGenerator: "Ninja" # Visual Studio 15 2017
-          cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
           cmakeListsTxtPath: "${{runner.workspace}}/clamav/CMakeLists.txt"
-          useVcpkgToolchainFile: true
-          cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DENABLE_EXAMPLES=ON -DENABLE_STATIC_LIB=ON -- -v'
-          cmakeBuildType: "${{ env.BUILD_TYPE }}"
-          vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
-          buildDirectory: "${{runner.workspace}}/build"
-
-      - name: Test
-        working-directory: ${{runner.workspace}}/build
-        # Execute tests defined by the CMake configuration.
-        # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
-        run: ctest -C ${{ env.BUILD_TYPE }} -V
-
-      - name: Create Installer
-        working-directory: ${{runner.workspace}}/build
-        run: cpack -C ${{ env.BUILD_TYPE }}
+          configurePreset: "clamav-windows-ninja-multi"
+          buildPreset: "windows-release"
+          testPreset: "windows-release"
+          packagePreset: "windows-release"

   build-macos:
     runs-on: macos-latest
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 000000000..b264c0943
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,70 @@
+{
+    "version": 9,
+    "configurePresets": [
+        {
+            "name": "clamav-windows",
+            "cacheVariables": {
+                "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
+            },
+            "hidden": true
+        },
+        {
+            "name": "clamav-windows-ninja-multi",
+            "inherits": "clamav-windows",
+            "generator": "Ninja Multi-Config",
+            "binaryDir": "${sourceDir}/build/${presetName}",
+            "cacheVariables": {
+                "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
+                "ENABLE_EXAMPLES": "ON",
+                "ENABLE_STATIC_LIB": "ON"
+            }
+        }
+    ],
+    "buildPresets": [
+        {
+            "name": "windows-release",
+            "configurePreset": "clamav-windows-ninja-multi",
+            "configuration": "Release"
+
+        }
+    ],
+    "testPresets": [
+        {
+            "name": "windows-release",
+            "configurePreset": "clamav-windows-ninja-multi",
+            "output": {"outputOnFailure": true, "verbosity": "verbose"},
+            "configuration": "Release"
+        }
+    ],
+    "packagePresets": [
+        {
+            "name": "windows-release",
+            "configurePreset": "clamav-windows-ninja-multi",
+            "generators": ["ZIP", "WIX"],
+            "configurations": ["Release"]
+        }
+    ],
+    "workflowPresets": [
+        {
+            "name": "windows-release",
+            "steps": [
+                {
+                    "type": "configure",
+                    "name": "clamav-windows-ninja-multi"
+                },
+                {
+                    "type": "build",
+                    "name": "windows-release"
+                },
+                {
+                    "type": "test",
+                    "name": "windows-release"
+                },
+                {
+                    "type": "package",
+                    "name": "windows-release"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 98c1b27a5..9bfa2049b 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -68,11 +68,7 @@ if(LLVM_FOUND)
     target_link_directories( ex_scan_callbacks PUBLIC ${LLVM_LIBRARY_DIRS} )
     target_link_libraries( ex_scan_callbacks PUBLIC ${LLVM_LIBRARIES} )
 endif()
-if(WIN32)
-    install(TARGETS ex_scan_callbacks DESTINATION .)
-else()
-    install(TARGETS ex_scan_callbacks DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif()
+install(TARGETS ex_scan_callbacks)

 add_executable(ex_cl_cvdunpack)
 target_sources(ex_cl_cvdunpack
@@ -85,6 +81,7 @@ if(LLVM_FOUND)
     target_link_directories( ex_cl_cvdunpack PUBLIC ${LLVM_LIBRARY_DIRS} )
     target_link_libraries( ex_cl_cvdunpack PUBLIC ${LLVM_LIBRARIES} )
 endif()
+install(TARGETS ex_cl_cvdunpack)

 if(ENABLE_STATIC_LIB)
     add_executable(ex_cl_cvdunpack_static)
@@ -98,4 +95,5 @@ if(ENABLE_STATIC_LIB)
         target_link_directories( ex_cl_cvdunpack_static PUBLIC ${LLVM_LIBRARY_DIRS} )
         target_link_libraries( ex_cl_cvdunpack_static PUBLIC ${LLVM_LIBRARIES} )
     endif()
+    install(TARGETS ex_cl_cvdunpack_static)
 endif()
diff --git a/vcpkg.json b/vcpkg.json
new file mode 100644
index 000000000..447d1677f
--- /dev/null
+++ b/vcpkg.json
@@ -0,0 +1,18 @@
+{
+    "builtin-baseline": "efcfaaf60d7ec57a159fc3110403d939bfb69729",
+    "dependencies": [
+        {
+            "name": "curl",
+            "features": ["openssl"]
+        },
+        "openssl",
+        "json-c",
+        "libxml2",
+       	"pcre2",
+        "check",
+       	"pthreads",
+       	"zlib",
+       	"pdcurses",
+       	"bzip2"
+    ]
+}