File: CMakeLists.txt

package info (click to toggle)
vtk9 9.1.0%2Breally9.1.0%2Bdfsg2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 153,832 kB
  • sloc: cpp: 1,800,419; ansic: 261,033; python: 86,332; yacc: 4,033; java: 3,977; xml: 3,068; sh: 2,702; perl: 2,189; lex: 1,761; objc: 143; makefile: 139; tcl: 59
file content (38 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
vtk_module_third_party_external(
  PACKAGE       MPI
  COMPONENTS    C
  TARGETS       MPI::MPI_C
  INCLUDE_DIRS  MPI_C_INCLUDE_DIRS MPI_C_INCLUDE_PATH
  LIBRARIES     MPI_C_LIBRARIES
  DEFINITIONS   MPI_C_COMPILE_DEFINITIONS
  STANDARD_INCLUDE_DIRS)

vtk_module_install_headers(
  FILES "${CMAKE_CURRENT_SOURCE_DIR}/vtk_mpi.h")

vtk_module_definitions(VTK::mpi
  INTERFACE
    MPICH_SKIP_MPICXX
    OMPI_SKIP_MPICXX
    MPI_NO_CPPBIND
    _MPICC_H)

if (APPLE AND TARGET MPI::MPI_C)
  # On macOS, MPI might have the `-Wl,-flat_namespace` option in it (mpich has
  # been observed). This is incompatible with `@rpath` usage, so if we see it,
  # just remove it from the link flags of the target.
  get_property(mpi_link_flags
    TARGET    MPI::MPI_C
    PROPERTY  INTERFACE_LINK_LIBRARIES)
  set(fixed_mpi_link_flags)
  foreach (mpi_link_flag IN LISTS mpi_link_flags)
    string(FIND "${mpi_link_flag}" "-Wl,-flat_namespace" idx)
    if (idx EQUAL "-1")
      list(APPEND fixed_mpi_link_flags
        "${mpi_link_flag}")
    endif ()
  endforeach ()
  set_property(TARGET MPI::MPI_C
    PROPERTY
      INTERFACE_LINK_LIBRARIES "${fixed_mpi_link_flags}")
endif ()