Skip to content

Commit

Permalink
Merge pull request #2 from phdum/unstable
Browse files Browse the repository at this point in the history
[cmake] stop MPI from including mpi-2 c++ bindings
  • Loading branch information
Wentzell authored May 7, 2020
2 parents eb811c9 + 9208522 commit 052acf9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion c++/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ target_link_libraries(mpi_c INTERFACE itertools::itertools_c)

message(STATUS "-------- MPI detection -------------")

set(MPI_CXX_SKIP_MPICXX TRUE BOOL)
find_package(MPI REQUIRED)

# Create an interface target
Expand All @@ -44,14 +45,19 @@ if(NOT MPIEXEC_EXECUTABLE)
set(MPIEXEC_EXECUTABLE ${MPIEXEC} CACHE FILENAME "MPI Executable")
endif()

# Backward compatibility for older FindMPI.cmake (without MPI_CXX_SKIP_MPICXX)
if(CMAKE_VERSION VERSION_LESS 3.10.3)
# Stop OpenMPI from including cxx binding headers, if installed
target_compile_definition(mpi_c PUBLIC MPICH_SKIP_MPICXX OMPI_SKIP_MPICXX _MPICC_H)
endif()

# Compatibility to Open-MPI 3.0.0: check whether MPI executable has option --oversubscribe and add it
execute_process(COMMAND ${MPIEXEC_EXECUTABLE} --oversubscribe ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} ls ${MPIEXEC_POSTFLAGS} RESULT_VARIABLE HAS_NO_OVERSUBSCRIBE OUTPUT_QUIET ERROR_QUIET)
if(NOT HAS_NO_OVERSUBSCRIBE)
list(APPEND MPIEXEC_PREFLAGS --oversubscribe)
set(MPIEXEC_PREFLAGS ${MPIEXEC_PREFLAGS} CACHE STRING "These flags will be directly before the executable that is being run by mpiexec." FORCE)
endif()


# ========= Static Analyzer Checks ==========

option(ANALYZE_SOURCES OFF "Run static analyzer checks if found (clang-tidy, cppcheck)")
Expand Down

0 comments on commit 052acf9

Please sign in to comment.