Issue
This should be simple however I'm struggling to find the correct setup for this.
I have a working declarative pipeline, compiling a c++ application using cmake on a Windows agent. I want to collect all the warnings and report on the dashboard.
According to the documentation the Warnings Next Generation easily support cmake.
The relevant part of the pipeline looks this:
pipeline {
stages {
stage( 'Build' ) {
steps {
cmake arguments: '''
-S .
-B build
-DQt6_DIR=C:\\Qt\\6.4.0\\msvc2019_64\\lib\\cmake\\Qt6
''', installation: 'InSearchPath'
cmake arguments: '--build build --configuration Release',
installation: 'InSearchPath'
}
}
}
post {
always {
recordIssues enabledForFailure: true, tool: cmake()
}
}
}
I'm using the CMake plugin configured as the documentation says, seen below:
I'm sure the configuration is correct because I can build the application with cmake. However I receive the following exception:
There is no Cmake installation selected. Please review the build step configuration and make sure the installation is configured on the Global Tool Configuration page.
As the error says, I checked the global configuration. The 'path to cmake option is not set but on the build agents I use pre installed cmake and the path of it added to the PATH
environment variable.
How can I tell this step where to find cmake?
If that not possible what are the alternative ways to report the compilation warnings?
I tried to redirect the output to a file and parse it, but the cmake()
does not support the pattern: "**/cmake_output.log"
parameter.
Solution
I think I should consider myself lucky that I'm on windows. We use MSVC as a compiler so we can rely on the default generator for CMake - in this case some form of Visual Studio.
That means when we call the cmake --build .
command under the hood MSBuild got called to manage the build. Therefore I can use the msBuild()
parser of the Jenkins plugin to parse the output and generate the chart.
Jenkinsfile (snippet):
pipeline {
stages {
// not relevant, just use the default generator for cmake
}
post {
always {
recordIssues enabledForFailure: true, tool: msBuild()
}
}
}
Answered By - zerocukor287 Answer Checked By - Mary Flores (WPSolving Volunteer)