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

Commit 539d0aa

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 e58e4b6 commit 539d0aa

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,43 @@ 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/InsightSoftwareConsortium/proxTV.git")
5250
set(proxTV_GIT_TAG "for/itk-proxtv-3.3.0-69062fe5")
51+
5352
FetchContent_Declare(
5453
proxtv_fetch
5554
GIT_REPOSITORY ${proxTV_GIT_REPOSITORY}
5655
GIT_TAG ${proxTV_GIT_TAG}
5756
)
5857

5958
# proxTV options:
59+
message(STATUS "TotalVariation_proxTV_USE_EIGEN: ${TotalVariation_proxTV_USE_EIGEN}")
6060
if(TotalVariation_proxTV_USE_EIGEN)
6161
set(proxTV_USE_LAPACK 0)
62+
if(NOT ITK_USE_SYSTEM_EIGEN)
63+
# Set Eigen3_DIR to the internal Eigen3 used in ITK
64+
set(Eigen3_DIR "${ITKInternalEigen3_DIR}")
65+
message(STATUS "ITKTotalVariation: Using internal ITK Eigen Config found in: ${Eigen3_DIR}")
66+
endif()
67+
find_package(Eigen3 REQUIRED)
68+
set(${PROJECT_NAME}_EXPORT_CODE_INSTALL
69+
"${${PROJECT_NAME}_EXPORT_CODE_INSTALL}
70+
find_package(OpenMP)
71+
set(Eigen3_DIR \"${Eigen3_DIR}\")
72+
find_package(Eigen3 REQUIRED CONFIG)
73+
")
74+
set(${PROJECT_NAME}_EXPORT_CODE_BUILD
75+
"${${PROJECT_NAME}_EXPORT_CODE_BUILD}
76+
if(NOT ITK_BINARY_DIR)
77+
find_package(OpenMP)
78+
set(Eigen3_DIR \"${Eigen3_DIR}\")
79+
find_package(Eigen3 REQUIRED CONFIG)
80+
endif()
81+
")
6282
else()
83+
# proxTV will be build with external system LAPACK instead of Eigen3
6384
set(proxTV_USE_LAPACK 1)
85+
add_compile_definitions(PROXTV_USE_LAPACK)
6486
endif()
6587

6688
# end proxTV options

0 commit comments

Comments
 (0)