Skip to content

build: Version control line cannot handle 10+ minor version #25802

@Kumataro

Description

@Kumataro

System Information

OpenCV version: 4.x ( 3f13ce7 )
Operating System / Platform: Ubuntu 24.04
Compiler & compiler version: GCC 13.2.0

Detailed description

Version control line in Build configration should be "4.10.0-595-...", nor "4.9.0-595-...".

-- General configuration for OpenCV 4.10.0-dev =====================================
--   Version control:               4.9.0-595-g3f13ce797b
--
--   Platform:
--     Timestamp:                   2024-06-22T02:17:04Z
--     Host:                        Linux 6.8.0-35-generic x86_64
--     CMake:                       3.28.3
--     CMake generator:             Ninja
--     CMake build tool:            /usr/bin/ninja
--     Configuration:               Release

I think supported minor version(2nd) is only 0-9, not 10+ in now. It should be update like patch version(3rd).

opencv/cmake/OpenCVUtils.cmake

Lines 1994 to 2005 in 3f13ce7

if(NOT GIT_RESULT EQUAL 0)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*" --exclude "[^-]*-cvsdk"
WORKING_DIRECTORY "${path}"
OUTPUT_VARIABLE ${var_name}
RESULT_VARIABLE GIT_RESULT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_RESULT EQUAL 0) # --exclude is not supported by 'git'
# match only tags with complete OpenCV versions (ignores -alpha/-beta/-rc suffixes)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9]*[0-9]"
WORKING_DIRECTORY "${path}"

- --match "[0-9].[0-9].[0-9]*"
+ --match "[0-9].[0-9]*.[0-9]*"

Steps to reproduce

git clone https://github.com/opencv/opencv.git
cmake -S opencv -B build_main -GNinja

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions