diff --git a/cmake/libigl-config.cmake.in b/cmake/libigl-config.cmake.in index 317c745c66..b59628e90a 100644 --- a/cmake/libigl-config.cmake.in +++ b/cmake/libigl-config.cmake.in @@ -2,6 +2,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/libigl-export.cmake) +if(@HUNTER_ENABLED@) + find_package(Eigen3 CONFIG REQUIRED) +endif() + if (TARGET igl::core) if (NOT TARGET Eigen3::Eigen) find_package(Eigen3 QUIET) diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake index 4b11007a0a..a472fc15f0 100644 --- a/cmake/libigl.cmake +++ b/cmake/libigl.cmake @@ -87,11 +87,16 @@ if(BUILD_SHARED_LIBS) set_target_properties(igl_common PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON) endif() -if(UNIX) +if(UNIX AND NOT HUNTER_ENABLED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") endif() +if(HUNTER_ENABLED) + hunter_add_package(Eigen) + find_package(Eigen3 CONFIG REQUIRED) +endif() + # Eigen if(TARGET Eigen3::Eigen) # If an imported target already exists, use it