Skip to content

Checking format of GET_VERSION output

Younes Otarid requested to merge yotarid-cmake_fix into master

Only considering tags starting with v[0-9]* in the git describe command using the --match argument in order to avoid issue with format of the PROJECT_VERSION variable in the CMakeLists.txt script.

Detailed explanation:
In fact in some cases, such as the petalinux build workflow, when Peary is included as a recipe, a peary git repository is automatically created and a devtool-base tag is automatically added. However, when the GET_VERSION function is called in the CMakeLists.txt [1], the return value of the git describe --tags HEAD [2] command would be devtool-base, which then leads to a wrong format of the returned value PROJECT_VERSION which remains devtool-base. The cmake command would then fail when calling the PROJECT function in the CMakeLists [3] with the error:

| CMake Error at CMakeLists.txt:35 (PROJECT):
|   VERSION "SIMPLE_VERSION" format invalid.

[1] https://gitlab.cern.ch/Caribou/peary/-/blob/master/CMakeLists.txt?ref_type=heads#L23
[2] https://gitlab.cern.ch/Caribou/peary/-/blob/master/cmake/tools.cmake?ref_type=heads#L16-19
[3] https://gitlab.cern.ch/Caribou/peary/-/blob/master/CMakeLists.txt?ref_type=heads#L35

Edited by Younes Otarid

Merge request reports