CMake file missing: OpenCVConfig-version.cmake (Feature #724)


Added by Johannes Jordan over 14 years ago. Updated over 13 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:- % Done:

0%

Category:build/install
Target version:-
Difficulty: Pull request:

Description

For automatic integration of OpenCV via find_package, OpenCV comes with the OpenCVConfig.cmake file. However, this only works if no required version number is passed to find_package.

As it is CMake's sole purpose of inflicting brain damage on sane developers (with the side effect of being a buld system), you need yet another file called OpenCVConfig-version.cmake to support the version feature. To quote CMake 2.6 (and holds for 2.8):

When the [version] argument is given Config mode will only find a
version of the package that claims compatibility with the requested
version (format is major[.minor[.patch[.tweak]]]). If the EXACT
option is given only a version of the package claiming an exact match
of the requested version may be found. CMake does not establish any
convention for the meaning of version numbers. Package version
numbers are checked by "version" files provided by the packages
themselves. For a candidate package confguration file
"<config-file>.cmake" the corresponding version file is located next
to it and named either "<config-file>-version.cmake" or
"<config-file>Version.cmake". If no such version file is available
then the configuration file is assumed to not be compatible with any
requested version. When a version file is found it is loaded to check
the requested version number. The version file is loaded in a nested
scope in which the following variables have been defined:

Please include this file into the OpenCV distribution to enable the version check functionality.


CMakeLists.txt.patch - adds support for OpenCVConfigVersion.cmake (2.3 kB) stathis --, 2010-12-05 09:26 pm

OpenCVConfigVersion.cmake.in - new file providing package version for FIND_PACKAGE (730 Bytes) stathis --, 2010-12-05 09:27 pm


Associated revisions

Revision 54511b41
Added by Andrey Kamaev almost 12 years ago

Merge pull request #724 from jet47:tvl1-updates

History

Updated by stathis -- over 14 years ago

I have attached here two files that should address the problem you have reported. Place the .in file in the root of the opencv src and patch the CMakeLists.txt with the patch. This patch was created against r4283.

Updated by Johannes Jordan over 14 years ago

Patch looks reasonable, however isn't the install() command missing regarding unix-install/ destination?

Updated by stathis -- over 14 years ago

you're right about the install() command I missed it and didn't notice, as I don't test on unix yet. I can send a second patch if you want that includes it, but the change should be trivial. Still, let me know.

Updated by Johannes Jordan over 14 years ago

It works: Applied to OpenCV 2.1 under Linux, I had added the appropriate line for unix-install/.

However, the file claims all OpenCV versions with same major version are compatible. OpenCV 2.0 being compatible to a requested 2.1, etc. This will probably not hold, so more fine-tuning to the file is necessary? Funny that in version 2.1 you already have to cover the possibility of incompatible version 2.8...

Probably it is better to only claim 'compatible' if the major is correct and minor is more or equal.

Updated by stathis -- about 14 years ago

I wrote the initial file so that there is an example of how to get it done. Developers should decide what would be the compatibility threshold. I agree with your comments on this, but I am not sure how a version increase is decided. Furthermore, it would be very neat to have the tweak part of the "major[.minor[.patch[.tweak]]]" version format assigned to the trunk's revision, don't you think?

I can write the necessary -version.cmake file as long as there is some guidance regarding compatibility.

Updated by Vadim Pisarevsky over 13 years ago

OpenCVConfig-version.cmake.in has been added in trunk and should be available in v2.3.1.

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF