Skip to content

build: obsolete cmake warning #22231

@tomoaki0705

Description

@tomoaki0705

Sorry to post warning issue

System information (version)
  • OpenCV => recent 3.4, master, next
  • Operating System / Platform => Ubuntu 18.04 (Aarch64) Jetson AGX Xavier
  • Compiler => GCC 7.5.0
  • CMake => 3.23.2
Detailed description

When building under above condition, following message appears.

-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
CMake Deprecation Warning at 3rdparty/carotene/hal/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at 3rdparty/carotene/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Looking for dlerror in dl

It's triggered by this line

cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)

I found the related topics on CMake Kitware forum

So this is a backward compatibility issue, and CMake is going to drop backward compatibility.
A workaround is to add the the latest supported version of cmake as the message says, but I don't think that's a better solution, since we now need to update this line every time new cmake appears.

Now looking at another aspect of this issue, OpenCV already defines MIN_VER_CMAKE in OpenCVMinDepVersions.cmake

set(MIN_VER_CMAKE 2.8.12.2)

(This line is picked from 3.4 branch)

So no matter what version of CMake is written in carotene/CMakeLists.txt, it doesn't make sense.
In another word, any cmake_minimum_request should refer this MIN_VER_CMAKE variable to be consistent.

So for this warning message, I propose to reuse MIN_VER_CMAKE where ever cmake_minimum_request is used.
For the actual cmake version, I think I should not touch.

I'll send a patch later.

Steps to reproduce
 cmake -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
 -DBUILD_EXAMPLES=true \
 -DOPENCV_ENABLE_NONFREE=true \
 -DWITH_CUDA=ON \
 -DWITH_EIGEN=OFF \
 -DPYTHON2_EXECUTABLE= \
 -DCMAKE_BUILD_TYPE=Release ..
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