Question: I have set up cmake tool under the Global tool configuration in Jenkins. I tried to reference it in my jenkinsfile but the build is giving this error:

```
'cmake is not a recognised command'.

```

This is how i am referencing it in the jenkinsfile :

```
stage('run CMake')
    {
         bat '''
         mkdir build
         cd build
         cmake -DBOOST_ROOT=E:/local/boost_1_64_0 -DOPC_UA_FRAMEWORK_ROOT=E:/local/bhi-opcuaframework-1.2.0-win32

```

And this is the configuration of CMake in the Jenkins dashboard:

[![enter image description here](https://i.stack.imgur.com/X9XF6.png)](https://i.stack.imgur.com/X9XF6.png)

This is how my setting in global tool config looks like. 

How do i correctly reference the tool in the pipeline? 

Please help!!

Answer: 
Use the `tool` step:

```
stage('run CMake')
{
     def cmakePath = tool 'CMake'
     bat """
     mkdir build
     cd build
     ${cmakePath}\\cmake -DBOOST_ROOT=...
     """
}

```
Do you have cmake installed on jenkins master? if not try to install it using installer.

Check the jenkins cmake wiki page screenshot check below, install it using installer if you haven't already check this help:

* [Tool Configuration](https://wiki.jenkins.io/display/JENKINS/Tool+Configuration)
* [Global Configuration](https://wiki.jenkins.io/display/JENKINS/Global+Configuration)
* [CMake Build Configuration](https://wiki.jenkins.io/display/JENKINS/CMake+Build+Configuration)