Skip to content

Commit

Permalink
Add the ParMmg VTK components requirement if Mmg is built with -DPMMG…
Browse files Browse the repository at this point in the history
…_CALL arg.
  • Loading branch information
Algiane committed Dec 7, 2023
1 parent dc78641 commit 61e75e5
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions cmake/modules/optional-dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,24 @@ ENDIF ( )
SET ( USE_VTK "" CACHE STRING "Use VTK I/O (ON, OFF or <empty>)" )
SET_PROPERTY(CACHE USE_VTK PROPERTY STRINGS "ON" "OFF" "")

IF ( PMMG_CALL )
SET ( PMMG_VTK_MESS "Mmg -" )
ENDIF ( )


IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_VTK )
# Variable is not provided by the user or is setted to on

# Handle vtk components name change between v8.2 and v9
# Before v9
FIND_PACKAGE(VTK QUIET)
IF ( VTK_FOUND )
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
message (STATUS "${PMMG_VTK_MESS} VTK_VERSION: ${VTK_VERSION}")

IF ( PMMG_CALL )
SET ( PMMG_VTK_COMP "vtkParallelCore vtkParallelMPI" )
ENDIF ( )

IF (VTK_VERSION VERSION_LESS "9.0.0")
find_package(VTK COMPONENTS
vtkCommonCore
Expand All @@ -117,8 +127,14 @@ IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_V
vtkIOParallel
vtkIOParallelXML
vtkIOXML
${PMMG_VTK_COMP}
QUIET)
ELSE()

IF ( PMMG_CALL )
SET ( PMMG_VTK_COMP "ParallelCore ParallelMPI" )
ENDIF ( )

# After v9
FIND_PACKAGE(VTK COMPONENTS
CommonCore
Expand All @@ -127,20 +143,21 @@ IF ( NOT DEFINED USE_VTK OR USE_VTK STREQUAL "" OR USE_VTK MATCHES " +" OR USE_V
IOParallel
IOParallelXML
IOXML
${PMMG_VTK_COMP}
QUIET)
ENDIF()

ELSEIF ( USE_VTK )
# USE_VTK is not empty so user explicitely ask for VTK...
# but it is not found: raise an error
MESSAGE(FATAL_ERROR "VTK library not found.")
MESSAGE(FATAL_ERROR "${PMMG_VTK_MESS} VTK library not found.")
ENDIF()
ENDIF()

IF ( VTK_FOUND AND NOT USE_VTK MATCHES OFF)
add_definitions(-DUSE_VTK)

MESSAGE ( STATUS "Compilation with VTK: add vtk, vtp and vtu I/O." )
MESSAGE ( STATUS "${PMMG_VTK_MESS} Compilation with VTK: add vtk, vtp and vtu I/O." )

IF( "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" LESS 8.90 )
INCLUDE ( ${VTK_USE_FILE} )
Expand Down

0 comments on commit 61e75e5

Please sign in to comment.