JenkinsNewbie1989
JenkinsNewbie1989

Reputation: 101

how to reference the tool that is set in the global tool configuration in Jenkins in the jenkinsfile?

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

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

How do i correctly reference the tool in the pipeline?

Please help!!

Upvotes: 0

Views: 6058

Answers (2)

badgerr
badgerr

Reputation: 7982

Use the tool step:

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

Upvotes: 3

Vishnu Sri Vineeth
Vishnu Sri Vineeth

Reputation: 19

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:

Upvotes: -1

Related Questions