I am encountering an inconsistency when executing CMake
through Jenkins compared to my local environment.
Locally, I utilise build.sh
to run CMake
without any issues. However, in Jenkins, I get the following error:
CMake Error at CMakeLists.txt:49 (project):
VERSION "-128-NOTFOUND.-128-NOTFOUND.-128-NOTFOUND" format invalid.
The related section in CMakeLists.txt (line 49) is:
project(myproject VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
DESCRIPTION "myproject"
LANGUAGES C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
I tried clearing cache on Jenkinsfile like this, but never worked:
stage("Cmake") {
steps {
script {
// Clear CMake Cache
def clearcache = "${WORKSPACE}/build"
sh "rm -rf ${clearcache}" // Modified to remove directory recursively
cmakeRun()
}
}
}
Why might this version format error be occurring only in Jenkins, and how can I resolve it?