[go: up one dir, main page]

CMake: Eigen3 version 5.0.1 is incompatible to 5.0.0

With the Eigen3 version 5.0.1 installed, the following find_package call (note there's no EXACT modifier here)

find_package (Eigen3 5.0.0 NO_MODULE REQUIRED)

fails with the following output

CMake Error at CMakeLists.txt:114 (find_package):
  Could not find a configuration file for package "Eigen3" that is compatible
  with requested version "5.0.0".
  The following configuration files were considered but not accepted:
    /usr/share/eigen3/cmake/Eigen3Config.cmake, version: 5.0.1
-- Configuring incomplete, errors occurred!

This is unexpected given semantic versioning is used.

The issue is caused by the following line:

if((_PACKAGE_VERSION_FULL VERSION_LESS PACKAGE_FIND_VERSION) OR (_PACKAGE_VERSION_FULL VERSION_GREATER_EQUAL _PACKAGE_FIND_VERSION_UPPER))

since the condition (_PACKAGE_VERSION_FULL VERSION_GREATER_EQUAL _PACKAGE_FIND_VERSION_UPPER) becomes true in this case (which expands to 5.0.1.0 == 5.0.1.0).