Skip to content
This repository was archived by the owner on Jun 6, 2026. It is now read-only.

Commit 97726f8

Browse files
committed
ENH: Use ITK's provided Eigen3Config.cmake to find Eigen
ITK's module Eigen require an itkeigen prefix to the paths and is not compatible with a system Eigen library without the use of a macro. This patch now restore the use of the vendored Eigen library from the alternative package interface.
1 parent 5f6e1d4 commit 97726f8

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ else() # build proxTV here with the selected Eigen3
4646
# set(CMAKE_CXX_EXTENSIONS OFF)
4747
endif()
4848

49-
set(proxTV_Eigen_LIBRARIES ITK::ITKEigen3Module)
50-
5149
set(proxTV_GIT_REPOSITORY "https://github.com/phcerdan/proxTV.git")
5250
set(proxTV_GIT_TAG "itk_installation")
5351
FetchContent_Declare(
@@ -57,10 +55,33 @@ else() # build proxTV here with the selected Eigen3
5755
)
5856

5957
# proxTV options:
58+
message(STATUS "TotalVariation_proxTV_USE_EIGEN: ${TotalVariation_proxTV_USE_EIGEN}")
6059
if(TotalVariation_proxTV_USE_EIGEN)
6160
set(proxTV_USE_LAPACK 0)
61+
if(NOT ITK_USE_SYSTEM_EIGEN)
62+
# Set Eigen3_DIR to the internal Eigen3 used in ITK
63+
set(Eigen3_DIR "${ITKInternalEigen3_DIR}")
64+
message(STATUS "ITKTotalVariation: Using internal ITK Eigen Config found in: ${Eigen3_DIR}")
65+
endif()
66+
find_package(Eigen3 REQUIRED)
67+
set(${PROJECT_NAME}_EXPORT_CODE_INSTALL
68+
"${${PROJECT_NAME}_EXPORT_CODE_INSTALL}
69+
find_package(OpenMP)
70+
set(Eigen3_DIR \"${Eigen3_DIR}\")
71+
find_package(Eigen3 REQUIRED CONFIG)
72+
")
73+
set(${PROJECT_NAME}_EXPORT_CODE_BUILD
74+
"${${PROJECT_NAME}_EXPORT_CODE_BUILD}
75+
if(NOT ITK_BINARY_DIR)
76+
find_package(OpenMP)
77+
set(Eigen3_DIR \"${Eigen3_DIR}\")
78+
find_package(Eigen3 REQUIRED CONFIG)
79+
endif()
80+
")
6281
else()
82+
# proxTV will be build with external system LAPACK instead of Eigen3
6383
set(proxTV_USE_LAPACK 1)
84+
add_compile_definitions(PROXTV_USE_LAPACK)
6485
endif()
6586

6687
# end proxTV options

0 commit comments

Comments
 (0)