Setup C++
Set up a C++ compiler and add it to the PATH.
This is usually the first step in your workflow after consuming a matrix generated by C++ Matrix.
The compiler parameter can be used to provide a compiler name or a compiler name with its version, separated
by whitespace or a -. Examples valid names are gcc, g++, clang, gcc-10, g++ 10, clang 9.2.
Note that strings like 10 and 9.2 are semver requirements and not semver versions. For instance, 10 represents
the requirement equivalent to >=10.0.0 <11.0.0 while 9.2 represents the requirement equivalent to
>=9.2.0 <9.3.0.
If the compiler parameter does not include a version requirement, the version parameter can be used to provide
a version semver string in the npm format with the compiler requirements.
If the compiler is GCC or Clang, this action routes to the appropriate Setup GCC or Setup Clang actions.
If the compiler is MSVC, this action will setup the developer command prompt for Microsoft Visual C+\+.
If the compiler is MinGW, this action will look for g++ and gcc in the directories listed in the PATH environment variable.
Any other compilers are passed through.
If the compiler is GCC or Clang, the outputs include the paths to the compilers as well as the compiler version ultimately setup by the action.
Next steps
After setting up the proper C++ compiler for a matrix entry, the next step in your workflow should usually be Install Packages.
Example
steps:
- name: Setup C++
uses: alandefreitas/cpp-actions/setup-cpp@v1.8.6
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
Input Parameters
Parameter |
Description |
Default |
|
Compiler name. If the compiler contains a version, it overrides 'version'. |
|
|
Version range or exact version of GCC to use, using SemVer’s version range syntax. By default, it uses any version available in the environment. |
|
|
The compiler executable. We attempt to find the compiler at this path first. |
|
|
By default, when the compiler is not available, this action will install the minimum version in the version spec. This ensures the code respects its contract in terms of what minimum GCC version is supported. Set this option if you want the action to check for the latest available version that satisfies the version spec instead. |
|
|
Set this option if you want the action to update environment variables. |
|
|
Trace commands executed by the workflow. |
|
Outputs
Output |
Description |
|
The absolute path to the C compiler executable. |
|
The absolute path to the C++ compiler executable. |
|
The absolute path to the directory containing the executable. |
|
The absolute path to the directory containing the installation. |
|
The installed compiler version. Useful when given a version range as input. |
|
The installed compiler version major. Useful when given a version range as input. |
|
The installed compiler version minor. Useful when given a version range as input. |
|
The installed compiler version patch. Useful when given a version range as input. |