Skip to content

Commit

Permalink
ATLAS-314 Support older Eigen versions (e.g. 3.2.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Oct 22, 2020
1 parent 91040ca commit e69c520
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cmake/atlas-import.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ if( atlas_HAVE_FORTRAN )
endif()

## Eigen3
if( atlas_HAVE_EIGEN )
find_dependency( Eigen3 HINTS @Eigen3_DIR@ )
set( Eigen3_HINT @Eigen3_DIR@ )
if( atlas_HAVE_EIGEN AND Eigen3_HINT )
find_dependency( Eigen3 HINTS ${Eigen3_HINT} )
endif()

## gridtools_storage
Expand Down
10 changes: 7 additions & 3 deletions cmake/features/EIGEN.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
### Eigen

set( Eigen3_NO_MODULE ON )
ecbuild_find_package( NAME Eigen3 VERSION 3.3 QUIET )
ecbuild_add_option( FEATURE EIGEN
DESCRIPTION "Use Eigen linear algebra library"
CONDITION TARGET Eigen3::Eigen )
REQUIRED_PACKAGES Eigen3 )

if( HAVE_EIGEN AND NOT TARGET Eigen3::Eigen )
# This is the case for older Eigen versions (e.g. 3.2.0)
ecbuild_add_library( TARGET atlas_eigen3 TYPE INTERFACE )
target_include_directories( atlas_eigen3 INTERFACE ${EIGEN3_INCLUDE_DIRS} )
add_library( Eigen3::Eigen ALIAS atlas_eigen3 )
endif()

0 comments on commit e69c520

Please sign in to comment.