Search code examples
cmakeazure-devopsgithub-actionsmsys2

cmake using GitHub Actions MSYS2


I am trying to convert an MSYS2 build from azure pipeline CI (which works) to github actions.

I am now stuck with cmake not being recognised as a command.

MSYS2 Cmake Error

My current (simplified) yaml is the following:

- uses: msys2/setup-msys2@v2
        with:
          msystem: MSYS
          install: >-
            git
            base-devel
            mingw-w64-${{ matrix.arch }}-gcc
            mingw-w64-${{ matrix.arch }}-cmake
          update: true

      - name: Move Checkout
        run: |
          Copy-Item -Path ".\temp" -Destination "C:\_" -Recurse
      - name: CI-Build
        shell: msys2 {0}
        run: |
          cd /C/_
          mkdir build
          cd build
          cmake -DCMAKE_FIND_LIBRARY_SUFFIXES='.a' -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/mingw64-x86_64.cmake -DCMAKE_BUILD_TYPE=Release -G 'MSYS Makefiles' ..
          make VERBOSE=1 -j4

Why is cmake not a recognised command?!


Solution

  • The answer is to change msystem from MSYS to MINGW64 this is because MSYS will target cygwin (which would require the cmake package as specified by Alex Reinking).

    Specifying MINGW64 will allow use of the mingw-w64-x86_64-cmake package correctly.