Partager via


CMake task

TFS 2017 | TFS 2015

Use this task to build with the CMake cross-platform build system.

Demands

cmake

Important

The Microsoft-hosted agents have CMake installed by default so you don't need to include a demand for CMake in your azure-pipelines.yml file. If you do include a demand for CMake you may receive an error. To resolve, remove the demand.

Arguments

Argument Description
cwd
Working Directory

(Optional) Working directory when CMake is run. The default value is build.

If you specify a relative path, then it is relative to your repo. For example, if you specify build, the result is the same as if you specified $(Build.SourcesDirectory)\build.

You can also specify a full path outside the repo, and you can use variables. For example: $(Build.ArtifactStagingDirectory)\build

If the path you specify does not exist, CMake creates it.


Default value: build
Argument aliases: workingDirectory
cmakeArgs
Arguments
(Optional) Arguments that you want to pass to CMake.

Task control options

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

FAQ

How do I enable CMake for Microsoft-hosted agents?

The Microsoft-hosted agents have CMake installed already so you don't need to do anything. You do not need to add a demand for CMake in your azure-pipelines.yml file.

How do I enable CMake for my on-premises agent?

  1. Deploy an agent.

  2. Install CMake and make sure to add it to the path of the user that the agent is running as on your agent machine.

  3. In your web browser, navigate to Agent pools:

    1. Navigate to your project and choose Settings (gear icon) > Agent Queues.

      Choose settings, Agent Queues, 2017.

    2. Choose Manage pools.

      Choose Manage pools, 2017.

  4. Navigate to the capabilities tab:

    Select the desired agent, and choose the Capabilities tab.

    Agent capabilities tab, 2017.

  5. Click Add capability and set the fields to cmake and yes.

  6. Click Save changes.

How does CMake work? What arguments can I use?

About CMake

CMake Documentation

Do I need an agent?

You need at least one agent to run your build or release.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.

My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?

This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on Azure Pipelines and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.