Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2020-01-29T19:49:44.630Z
Answers: 2020-01-29T19:49:44.630Z
Answers: Preston Martin
Body: <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>
  
Tags: <jenkins>
Title: Minimal CMake Jenkinsfile failing
UserDisplayName: ezekiel
ThreadText: # 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 <stdio.h>
  #include <opencv2/opencv.hpp>
  
  using namespace cv;
  
  int main(int argc, char** argv )
  {
      if ( argc != 2 )
      {
          printf("usage: DisplayImage.out <Image_Path>\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](https://jenkins.io/doc/pipeline/steps/cmakebuilder/) installed. Also, add parenthesis to your cmakeBuild statement in your pipeline
  
  ```
  pipeline {
    agent any
    stages {
      stage('build') {
        steps {
            cmakeBuild(
              installation: 'InSearchPath'
            )
        }
      }
    }
  }
  
  ```
  
  
  ---
  
  