FindMPI: Use compiler implicit link dirs for matching language (#14870)
Update the logic added by commit 2f9ad7c6
(Fix FindMPI for the intel
compiler on linux, 2012-03-20) to use the implicit link directories for
the current ${lang} instead of hard-coding C or CXX which may not be
enabled. This is necessary for Fortran-only projects.
This commit is contained in:
parent
3927747547
commit
856bfe238c
|
@ -378,19 +378,14 @@ function (interrogate_mpi_compiler lang try_libs)
|
||||||
# Extract the set of libraries to link against from the link command
|
# Extract the set of libraries to link against from the link command
|
||||||
# line
|
# line
|
||||||
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
|
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
|
||||||
|
|
||||||
# add the compiler implicit directories because some compilers
|
# add the compiler implicit directories because some compilers
|
||||||
# such as the intel compiler have libraries that show up
|
# such as the intel compiler have libraries that show up
|
||||||
# in the showme list that can only be found in the implicit
|
# in the showme list that can only be found in the implicit
|
||||||
# link directories of the compiler. Do this for C++ and C
|
# link directories of the compiler.
|
||||||
# compilers if the implicit link directories are defined.
|
if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
|
||||||
if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
|
|
||||||
set(MPI_LINK_PATH
|
set(MPI_LINK_PATH
|
||||||
"${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
|
"${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
|
|
||||||
set(MPI_LINK_PATH
|
|
||||||
"${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Determine full path names for all of the libraries that one needs
|
# Determine full path names for all of the libraries that one needs
|
||||||
|
|
Loading…
Reference in New Issue