@@ -802,34 +802,22 @@ endif(UDUNITS2)
802
802
# -DEIGEN3=ON|OFF
803
803
# -DEIGEN3DIR=DIR
804
804
if (EIGEN3)
805
- # cleaning Cache ...
806
- if (EIGEN3DIR)
807
- unset (EIGEN3_INCLUDE_DIR CACHE )
808
- endif (EIGEN3DIR)
809
- #
810
- set (CMAKE_PREFIX_PATH ${EIGEN3DIR} )
811
- find_package (Eigen3 3.2.4 QUIET )
812
- if (EIGEN3_TOO_OLD)
813
- # on iCore 3/5/7 we must have Eigen >=3.2.4 to avoid fatal error in "test_matrix_multiply.pro"
814
- message (FATAL_ERROR "\n EIGEN3 is required but the version found is TOO OLD."
815
- " Please download a recent version (>=3.2.4) in a local directory."
816
- " Then use -DEIGEN3DIR=DIR to specify the Eigen3 local directory tree.\n "
817
- "Use -DEIGEN3=OFF to not use it.\n " )
818
- else (EIGEN3_TOO_OLD)
819
- set (USE_EIGEN ${EIGEN3_FOUND} )
820
- if (EIGEN3_FOUND)
821
- include_directories (${EIGEN3_INCLUDE_DIR} )
822
- if (MINGW)
823
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-ipa-cp-clone" )
824
- endif (MINGW)
825
- else (EIGEN3_FOUND)
826
- message (FATAL_ERROR "EIGEN3 is required but was not found.\n "
827
- "Use -DEIGEN3DIR=DIR to specify the Eigen3 directory tree.\n "
828
- "Use -DEIGEN3=OFF to not use it.\n "
829
- "(suitable Fedora/CentOS package: eigen3-devel)\n "
830
- "(suitable Debian/Ubuntu package: libeigen3-dev)" )
831
- endif (EIGEN3_FOUND)
832
- endif (EIGEN3_TOO_OLD)
805
+ find_package (Eigen3 QUIET REQUIRED NO_MODULE)
806
+ # Note: Eigen3 moved to semantic versioning in 5.0.0; so WORLD.MAJOR.MINOR
807
+ # becomes MAJOR.MINOR.PATCH, WORLD will forever be 3
808
+ # see: https://gitlab.com/libeigen/eigen/-/releases/5.0.0
809
+
810
+ # we need at least version 3.2.4, => world 3, major 2, minor 4
811
+ if (${Eigen3_VERSION_MAJOR} VERSION_LESS 2
812
+ OR (
813
+ ${Eigen3_VERSION_MAJOR} VERSION_EQUAL 2 AND ${Eigen3_VERSION_MINOR} VERSION_LESS 4
814
+ )
815
+ )
816
+ message (FATAL_ERROR
817
+ "Found Eigen3 version '${Eigen3_VERSION} ' when needing at least version 3.2.4.\n "
818
+ "Consider installing a newer version or switch off Eigen3 by setting '-DEIGEN3=OFF'"
819
+ )
820
+ endif ()
833
821
endif (EIGEN3)
834
822
835
823
# grib
0 commit comments