<p>Verify that you have the correct <a href="https://jenkins.io/doc/pipeline/steps/cmakebuilder/" rel="nofollow noreferrer">CMake Plugin</a> installed. Also, add parenthesis to your cmakeBuild statement in your pipeline</p>

<pre><code>pipeline {
  agent any
  stages {
    stage('build') {
      steps {
          cmakeBuild(
            installation: 'InSearchPath'
          )
      }
    }
  }
}
</code></pre>

CC BY-SA 4.0
2020-01-29T19:49:44.630Z
2020-01-29T19:49:44.630Z
Preston Martin
<p>Why is this Jenkins build failing? How can I write a Jenkins file just to test the building of this simple project?</p>

<p><em>DisplayImage.cpp</em></p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;opencv2/opencv.hpp&gt;

using namespace cv;

int main(int argc, char** argv )
{
    if ( argc != 2 )
    {
        printf("usage: DisplayImage.out &lt;Image_Path&gt;\n");
        return -1;
    }

    Mat image;
    image = imread( argv[1], 1 );

    if ( !image.data )
    {
        printf("No image data \n");
        return -1;
    }
    namedWindow("Display Image", WINDOW_AUTOSIZE );
    imshow("Display Image", image);

    waitKey(0);

    return 0;
}
</code></pre>

<p><em>CMakeLists.txt</em></p>

<pre><code>cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
</code></pre>

<p><em>Jenkinsfile</em></p>

<pre><code>pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                cmakeBuild
                installation: 'InSearchPath'
            }
        }
    }
}
</code></pre>

<p>Output from Jenkins</p>

<pre><code>WorkflowScript: 6: Expected a step @ line 6, column 17.
                   cmakeBuild
                   ^

WorkflowScript: 7: Expected a step @ line 7, column 31.
                   installation: 'InSearchPath'
</code></pre>

<jenkins>
Minimal CMake Jenkinsfile failing
ezekiel
# Minimal CMake Jenkinsfile failing

(Asked by: username_0 on 2020-01-29)

Why is this Jenkins build failing? How can I write a Jenkins file just to test the building of this simple project?
DisplayImage.cpp
#include 
#include 

using namespace cv;

int main(int argc, char** argv )
{
    if ( argc != 2 )
    {
        printf("usage: DisplayImage.out \n");
        return -1;
    }

    Mat image;
    image = imread( argv[1], 1 );

    if ( !image.data )
    {
        printf("No image data \n");
        return -1;
    }
    namedWindow("Display Image", WINDOW_AUTOSIZE );
    imshow("Display Image", image);

    waitKey(0);

    return 0;
}

CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

Jenkinsfile
pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                cmakeBuild
                installation: 'InSearchPath'
            }
        }
    }
}

Output from Jenkins
WorkflowScript: 6: Expected a step @ line 6, column 17.
                   cmakeBuild
                   ^

WorkflowScript: 7: Expected a step @ line 7, column 31.
                   installation: 'InSearchPath'

**Tags:** jenkins


---

## 1 answers

### Answer by username_1 on 2020-01-29. Score: 3 | Accepted answer

Verify that you have the correct CMake Plugin installed. Also, add parenthesis to your cmakeBuild statement in your pipeline
pipeline {
  agent any
  stages {
    stage('build') {
      steps {
          cmakeBuild(
            installation: 'InSearchPath'
          )
      }
    }
  }
}


---

