Install directory inside the github action runner for cmake install target

285 Views Asked by At

I want to use the command make install inside a github runner. Before I can use it I have to set the install directory path, but I don't know it. Can anyone help me?

The steps in the workflow for the cmake look like:

- name: Configure CMake
  run: cmake -B ${{github.workspace}}/build -DBUILD_EXAMPLES=OFF -DBUILD_FORTRAN_MODULE=OFF -CMAKE_BUILD_PREFIX=<path-to-the-install-dir>

- name: Build
  run: cmake --build ${{github.workspace}}/build  

- name: Install
  run: make install

When I use as install dir /home/runner/work/ I get this error in the CI:

Run cmake -B /home/runner/work/xxx/xxx/build -DBUILD_EXAMPLES=OFF -DBUILD_FORTRAN_MODULE=OFF -CMAKE_BUILD_PREFIX=/home/runner/work/
  cmake -B /home/runner/work/xxx/xxx/build -DBUILD_EXAMPLES=OFF -DBUILD_FORTRAN_MODULE=OFF -CMAKE_BUILD_PREFIX=/home/runner/work/
  shell: /usr/bin/bash -e {0}
loading initial cache file MAKE_BUILD_PREFIX=/home/runner/work/
CMake Error: Error processing file: /home/runner/work/xxx/xxx/MAKE_BUILD_PREFIX=/home/runner/work
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!
See also "/home/runner/work/xxx/xxx/build/CMakeFiles/CMakeOutput.log".
Error: Process completed with exit code 1.
1

There are 1 best solutions below

0
On

The problem was that the command make install was called in wrong directory. make install has to be called inside the build directory.

Code works:

  - name: Configure CMake
      run: cmake -B ${{github.workspace}}/build -DBUILD_EXAMPLES=OFF -DBUILD_FORTRAN_MODULE=OFF -DCMAKE_INSTALL_PREFIX=/home/runner/work/

    - name: Build
      run: cmake --build ${{github.workspace}}/build  
    
    - name: Install
      run: cd build && make install