The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

CMake plugin

cmake: Run cmake with arbitrary arguments

Runs the tool and returns the exit code of the process.
  • installation
    • Type: String
  • arguments (optional)
    • Type: String
  • ignoredExitCodes (optional)
    • Type: String
  • workingDir (optional)
    • Type: String

cmakeBuild: Generate build-scripts with cmake and execute them

Uses CMake to generate build-scripts and can run these.
This invokes cmake with the given options to generate the build scripts.
Any non-zero exit code during build-script generation causes Jenkins to mark the build as a failure.

To run the generated build script, you have to add build tool invocation steps.

For example, to run the equivalent of the sh shell script

   mkdir build && cd build
   cmake -G Ninja <workpace-root>/source
   DESTDIR=<workpace-root>/artifacts ninja all install
  
you would enter the following pipeline script:

  cmakeBuild
      generator: 'Ninja',
      buildDir: 'build',
      sourceDir: 'source',
      installation: 'InSearchPath',
      steps: [
          [args: 'all install', envVars: 'DESTDIR=${WORKSPACE}/artifacts']
      ]
  
  • installation
    • Type: String
  • buildDir (optional)
    • Type: String
  • buildType (optional)
    • Type: String
  • cleanBuild (optional)
    • Type: boolean
  • cmakeArgs (optional)
    • Type: String
  • generator (optional)
    • Type: String
  • preloadScript (optional)
    • Type: String
  • sourceDir (optional)
    • Type: String
  • steps (optional)
      Array/List
      Nested Object
    • args (optional)
      Specify arguments to pass to the build tool or to cmake. Arguments must be separated by spaces but may contain spaces if they are enclosed in double quotes (will be handled like a Unix shell does),
      Most of the time, you will want to leave this empty (to call the default build target) or you will specify just some build target names here.
      • Type: String
    • envVars (optional)
      Specify extra environment variables to pass to the build tool as key-value pairs here.
      Each entry must be on its own line, for example:
      DESTDIR=${WORKSPACE}/artifacts/dir
      KEY=VALUE
      • Type: String
    • withCmake (optional)
      Whether to run the actual build tool directly (by expanding $CMAKE_BUILD_TOOL) or to have cmake run the build tool (by invoking cmake --build <dir>).
      • Leave unchecked for minimal performance overhead.
      • Make it checked, if you selected one of the Visual Studio or Xcode generators above AND if you run CMake v. 2.8.11 or newer.
      • Type: boolean

cpack: Run cpack

Runs the tool and returns the exit code of the process.
  • installation
    • Type: String
  • arguments (optional)
    • Type: String
  • ignoredExitCodes (optional)
    • Type: String
  • workingDir (optional)
    • Type: String

ctest: Run ctest

Runs the tool and returns the exit code of the process.
  • installation
    • Type: String
  • arguments (optional)
    • Type: String
  • ignoredExitCodes (optional)
    • Type: String
  • workingDir (optional)
    • Type: String

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.