Home > Back-end >  Github actions CMake: Error Cannot load cache
Github actions CMake: Error Cannot load cache

Time:08-11

I moved my CMakeLists.txt from the root into my src/ directory and I reconfigured my CMake workflow. The error comes from the build scope. Error loading Cache.

My Configuration:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Configure CMake
      run: cmake ${{github.workspace}}/src -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

    - name: Build
      run: cmake --build  ${{github.workspace}}/src --config ${{env.BUILD_TYPE}}

    - name: Test
      working-directory: ${{github.workspace}}/src/build
      run: ctest -C ${{env.BUILD_TYPE}}

CodePudding user response:

With the command cmake ${{github.workspace}}/src -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} you set the location of the CMakeLists.txt, the cmake output directory is still the current working directory .. This output directory should be passed to --build

- name: Build
  run: cmake --build . --config ${{env.BUILD_TYPE}}
  • Related