Github 动作中的 Cmake 和 PugiXML

Cmake and PugiXML in Github Actions

我尝试在 github 操作中获取 pugixml 运行。我会对任何有效的解决方案感到满意...

我把下载添加到 cmake.yml

      run: sudo apt-get update && sudo apt-get install libsystemd-dev libpugixml-dev

Ubuntu inside github 操作正在安装 1.10-1:

Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml1v5 amd64 1.10-1 [89.9 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml-dev amd64 1.10-1 [105 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libsystemd-dev amd64 245.4-4ubuntu3.11 [246 kB]

在我的私人机器上,我使用 Debian 测试,其中安装了版本:1.11.4-1 的 pugixml。

CMake 现在告诉它找不到 1.10 或更高版本。看起来 ubuntu 的版本标签不正确(?)。有没有办法在这些 github-actions 中进行调试?

CMake Deprecation Warning at plog/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Checking for module 'libsystemd'
--   Found libsystemd, version 245
CMake Error at CMakeLists.txt:20 (find_package):
  Could not find a configuration file for package "pugixml" that is
-- Configuring incomplete, errors occurred!
  compatible with requested version "1.10".
See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeOutput.log".

See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeError.log".
  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown
    /lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown

我用vcpkg安装pugixml解决了:

    - name: Install pugixml via vcpkg
      run: sudo vcpkg install pugixml && sudo vcpkg integrate install
  
    - name: Configure CMake
      # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
      # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
      run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
    - name: Build
      # Build your program with the given configuration
      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}