Commit Graph

64 Commits

Author SHA1 Message Date
Brad King 4d2c629045 Merge topic 'FindMPI-parse-Xlinker-flags'
a0792c48 FindMPI: Extract -Xlinker options
2014-12-15 11:06:42 -05:00
Alin Marin Elena a0792c4851 FindMPI: Extract -Xlinker options
Extend the regex that mathces -Wl, linker options to match -Xlinker too.
These are used by Intel MPI and perhaps others.
2014-12-12 09:53:43 -05:00
Ben Boeckel 17a846ac3e FindMPI: search for msmpi's mpiexec as well 2014-12-11 17:26:06 -05:00
Alin Marin Elena 7626c8dcf6 FindMPI: Workaround Intel MPI 5.0.1 exit code problem (#15182)
This MPI compiler may return zero even in some error cases.  Check the
output to catch such cases.

Suggested-by: Kelly Thompson <kgt@lanl.gov>
2014-12-04 14:15:46 -05:00
Alin Marin Elena f5ede30006 FindMPI: Factor out compiler wrapper execution into helper 2014-12-04 14:12:34 -05:00
Ben Boeckel 29c3edb87a Avoid if() quoted auto-dereference
When testing CMAKE_<LANG>_COMPILER_ID values, do not explicitly
dereference or quote the variable. We want if() to auto-dereference the
variable and not its value. Also replace MATCHES with STREQUAL where
equivalent.
2014-10-20 11:49:16 -04:00
Marcel Loose 150c2125dd FindMPI: Honor MPI_HOME for MPIEXEC (#14347)
We already use MPI_HOME and ENV{MPI_HOME} as hints for the location
of the MPI compilers.  Do the same for mpiexec, and then use the
location of mpiexec as a hint to find the compilers.
2014-08-11 13:09:02 -04:00
Brad King 18aaed77c0 Merge topic 'matches-cleanup'
f21ac16e Replace MATCHES test on numbers with EQUAL test
7eacbaed Replace MATCHES ".+" tests with NOT STREQUAL ""
3a71d34c Use CMAKE_SYSTEM_NAME instead of CMAKE_SYSTEM where sufficient
b0b4b460 Remove .* expressions from beginning and end of MATCHES regexs
5bd48ac5 Replace string(REGEX REPLACE) with string(REPLACE) where possible
2622bc3f Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
2014-04-15 10:22:34 -04:00
Rolf Eike Beer 5bd48ac534 Replace string(REGEX REPLACE) with string(REPLACE) where possible
The simple replacement is much faster.
2014-04-14 18:17:05 +02:00
Melven Roehrig-Zoellner 856bfe238c 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.
2014-04-11 09:59:48 -04:00
Kitware Robot f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Andreas Mohr bf019d765d Fix spelling and typos (non-binary) 2013-05-07 08:39:19 -04:00
Rolf Eike Beer 8ebf74b02f Find* (and some other): use ${CMAKE_CURRENT_LIST_DIR} in include()
This solves a lots of warnings, e.g. in the FindModulesExecuteAll test. If the
installed version on the system is rather old this may even lead to bugs, e.g.
https://bugs.gentoo.org/show_bug.cgi?id=436540
2012-11-04 05:55:37 +01:00
David Cole 8b7a5c6166 FindMPI: Set correct variables for calls to FPHSA
Since FPHSA is called for multiple compiler languages with "MPI_${lang}"
rather than just "MPI", make sure variables for controlling QUIET,
REQUIRED and VERSION are propagated with names prefixed by MPI_${lang}
as well, rather than just MPI.

The find_package call sets up the values of MPI_FIND_REQUIRED and friends,
but these calls to FPHSA need MPI_${lang}_FIND_REQUIRED and friends in
order to function as intended.
2012-09-27 00:41:28 -04:00
Bill Hoffman 2f9ad7c6e6 Fix FindMPI for the intel compiler on linux by looking in implict directories.
Use the CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES to look for libraries
that are in the -showme output from mpi<lang> programs. This is because
some libraries reported by -showme are found there, and FindMPI will
fail if they are not found.
2012-03-20 15:18:53 -04:00
Brad King 87737e62e0 FindMPI: Append MPI C++ library correctly in non-compiler case (#12874)
When we have no MPI compiler wrapper and search explicitly for the MPI
C++ library append it correctly to the list of libraries instead of
using a space.

Suggested-by: Mourad Boufarguine <bouffa@gmail.com>
2012-01-16 09:03:08 -05:00
Todd Gamblin 8756e77fb4 Fix issues with removing try_compile input file.
- Don't remove input file
- Put output in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}
- Remove try_compile variable from the cache after using
2011-06-21 14:02:01 -07:00
Todd Gamblin e00d2c4d51 Try regular compiler when no MPI compiler.
If FindMPI can't interrogate any of the available compilers, it attempts to compile simple MPI
programs with CMAKE_${lang}_COMPILER.  If this works, it uses that as MPI_${lang}_COMPILER.

This allows MPI to be discovered on Cray XT/XE systems, where modules are used and cc, CC, and ftn
compilers *are* MPI compilers.
2011-06-21 10:14:01 -07:00
Todd Gamblin a55da06948 Added backward compatibility for input as well as output vars.
Users can now supply MPI_COMPILER, MPI_INCLUDE_PATH, MPI_LIBRARY,
and others as with the old FindMPI.  These are mapped to their
respective equivalents for C and CXX.  Fortran is not touched, as
there was no Fortran support in the old FindMPI.
2011-04-24 18:55:23 +09:00
Brad King a32a633225 FindMPI: Fix documentation formatting
Adjust whitespace to make the output of "--help-module FindMPI" look
good.  Also separate the comment containing the copyright and license
notice so it does not appear in the documentation.
2011-03-16 10:11:33 -04:00
Todd Gamblin 706b73e848 FindMPI: Handle multiple languages
Adds support for:

- MPI_<lang>_COMPILER and other useful variables for C, CXX, Fortran
- Better compiler interrogation (handles mvapich)
- Supports specifying an MPI compiler name directly on the command line
  without and absolute path, e.g.: cmake -D MPI_CXX_COMPILER=mpixlC
- Better compiler name searching tries to match MPI compiler to regular
  CMAKE_<lang>_COMPILER_ID, if it's available.

Gets rid of:

- MPI_LIBRARY, MPI_EXTRA_LIBRARY cache variables.  These and other old
  vars are still exported for backward compatibility, but they're not
  cached.
2011-03-15 15:07:34 -04:00
Brad King c4275592a8 Modules: Include builtin FindPackageHandleStandardArgs directly
The FindPackageHandleStandardArgs module was originally created outside
of CMake.  It was added for CMake 2.6.0 by commit e118a627 (add a macro
FIND_PACKAGE_HANDLE_STANDARD_ARGS..., 2007-07-18).  However, it also
proliferated into a number of other projects that at the time required
only CMake 2.4 and thus could not depend on CMake to provide the module.
CMake's own find modules started using the module in commit b5f656e0
(use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS in some of the FindXXX
modules..., 2007-07-18).

Then commit d358cf5c (add 2nd, more powerful mode to
find_package_handle_standard_args, 2010-07-29) added a new feature to
the interface of the module that was fully optional and backward
compatible with all existing users of the module.  Later commit 5f183caa
(FindZLIB: use the FPHSA version mode, 2010-08-04) and others shortly
thereafter started using the new interface in CMake's own find modules.
This change was also backward compatible because it was only an
implementation detail within each module.

Unforutnately these changes introduced a problem for projects that still
have an old copy of FindPackageHandleStandardArgs in CMAKE_MODULE_PATH.
When any such project uses one of CMake's builtin find modules the line

  include(FindPackageHandleStandardArgs)

loads the copy from the project which does not have the new interface!
Then the including find module tries to use the new interface with the
old module and fails.

Whether this breakage can be considered a backward incompatible change
in CMake is debatable.  The situation is analagous to copying a standard
library header from one version of a compiler into a project and then
observing problems when the next version of the compiler reports errors
in its other headers that depend on its new version of the original
header.  Nevertheless it is a change to CMake that causes problems for
projects that worked with previous versions.

This problem was discovered during the 2.8.3 release candidate cycle.
It is an instance of a more general problem with projects that provide
their own versions of CMake modules when other CMake modules depend on
them.  At the time we resolved this instance of the problem with commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28) for the 2.8.3 release.

In order to address the more general problem we introduced policy
CMP0017 in commit db44848f (Prefer files from CMAKE_ROOT when including
from CMAKE_ROOT, 2010-11-17).  That change was followed by commit
ce28737c (Remove usage of CMAKE_CURRENT_LIST_DIR now that we have
CMP0017, 2010-12-20) which reverted the original workaround in favor of
using the policy.  However, existing project releases do not set the
policy behavior to NEW and therefore still exhibit the problem.

We introduced in commit a364daf1 (Allow users to specify defaults for
unset policies, 2011-01-03) an option for users to build existing
projects by adding -DCMAKE_POLICY_DEFAULT_CMP0017=NEW to the command
line.  Unfortunately this solution still does not allow such projects to
build out of the box, and there is no good way to suggest the use of the
new option.

The only remaining solution to keep existing projects that exhibit this
problem building is to restore the change originally made in commit
b0118402 (Use absolute path to FindPackageHandleStandardArgs.cmake
everywhere, 2010-09-28).  This also avoids policy CMP0017 warnings for
this particular instance of the problem the policy addresses.
2011-01-20 10:56:49 -05:00
Alex Neundorf ce28737c93 Remove usage of CMAKE_CURRENT_LIST_DIR now that we have CMP0017
This puts the new search behaviour for included files in action, i.e.
now when a file from Modules/ include()s another file, it also gets the
one from Modules/ included, i.e. the one it expects.

Alex
2011-01-04 08:20:08 -05:00
David Cole b0fb2ad3e1 Merge topic 'AddCMAKE_CURRENT_LIST_DIR'
b011840 Use absolute path to FindPackageHandleStandardArgs.cmake everywhere
41e4f1a Add automatic variable CMAKE_CURRENT_LIST_DIR(dir of CMAKE_CURRENT_LIST_FILE)
f9fc79c Remove trailing whitespace
2010-10-19 15:53:16 -04:00
David Partyka 35d2770df9 Update module to locate newely released MS MPI HPC Pack R2. 2010-10-11 09:20:07 -04:00
Alex Neundorf b01184022b Use absolute path to FindPackageHandleStandardArgs.cmake everywhere
This is to avoid getting an (older) copy of FPHSA.cmake which is
e.g. installed with KDE 4.5.0 and 4.5.1.

Alex
2010-09-28 22:30:31 +02:00
Brad King a56969f3d3 FindMPI: Recoginze -f flags from mpicc (#10771)
Parse compiler flags like "-fmessage-length=0 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing" from
the output of "mpicc -show".  We already handle preprocessor definition
arguments like -DUSE_STDARG.  Honor '-f' flags too.
2010-09-20 09:08:08 -04:00
Todd Gamblin 2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Brad King f315c29966 Merge branch 'FindMPI-flag-parsing' 2010-07-06 10:19:48 -04:00
Brad King 96c7cb26e9 FindMPI: Fix parsing of mpicc -Wl,-L link flags (#9093)
Commit d84cbd0f (FindMPI: Parse mpicc flags more carefully, 2010-06-24)
broke parsing of '-L' flags appearing after '-Wl,' by expecting a
preceding space.  Update the regular expression to allow '-Wl,-L' too.
2010-06-29 10:59:52 -04:00
Brad King cea9389cc9 FindMPI: Trust mpicc -showme on BlueGene/L
Do not hard-code known BlueGene/L MPI libraries.  We do not know their
location so the linker cannot find them without the proper -L search
path.  The MPI compiler tells us about the libraries anyway, and if it
does not then the user can fix the problem locally by editing the
MPI_EXTRA_LIBRARY cache entry.
2010-06-28 11:42:34 -04:00
Brad King 8460059a72 FindMPI: Failure is not an error if not REQUIRED 2010-06-28 11:35:18 -04:00
Brad King d84cbd0f77 FindMPI: Parse mpicc flags more carefully (#9093)
Extend the fix from commit 68c7d3e2 (FindMPI: Do not parse -l in middle
of library name, 2010-06-24).  Parse -D, -I, -L, and -Wl only with
preceding spaces or at the beginning of the string.
2010-06-25 08:00:38 -04:00
Brad King 68c7d3e2ce FindMPI: Do not parse -l in middle of library name
We parse the output of 'mpicc -shome:link' to look for -l options
specifying libraries.  Fix the parsing regex to avoid matching the
string '-l' in the middle of a library name.
2010-06-24 11:07:19 -04:00
David Partyka 01f022c49c Add a new registry key to check for the location of MPICH2. 2010-03-11 10:42:07 -05:00
Dave Partyka 3154cde792 BUG: rename MPI_PACKAGE_DIR and MPI_PREFIX_PATH vars to be prefixed with _ to prevent conflicts with known variable names in other projects. 2009-11-13 10:57:01 -05:00
Dave Partyka 279e4ec33b BUG: fix MPI_BASE_DIR var to be called _MPI_BASE_DIR to prevent conflicts with known variable names in other projects. 2009-11-13 10:52:28 -05:00
Dave Partyka 39e88bbe99 COMP: need to add quotes when using get_filename_component otherwise it will try to process NOT FOUND rather than an empty string when MPIEXEC is not found. 2009-10-27 13:10:01 -04:00
Dave Partyka c283fe2d26 COMP: fix syntax error. 2009-10-27 12:57:30 -04:00
Dave Partyka 4915e92998 ENH: Improvements in finding MPI on windows. ENH: reorganized searching mpi for mpi components (include,lib,bin) using a single set of search paths instead of seperately mainted lists of paths for each. 2009-10-27 12:43:50 -04:00
Brad King c4bb9c9d42 Convert CMake find-modules to BSD License
This adds copyright/license notification blocks CMake's find-modules.
Many of the modules had no notices at all.  Some had notices referring
to the BSD license already.  This commit normalizes existing notices and
adds missing notices.
2009-09-28 11:45:50 -04:00
David Cole b71332914f Oops. Close strings with double quotes. Where they're supposed to be. 2009-09-04 18:19:06 -04:00
David Cole 5655ac46f0 Add MPICH2 and Microsoft HPC paths, add paths to find mpiexec. Now it works better automatically on Windows. Thanks to Dave Partyka for developing the patch. 2009-09-04 18:02:05 -04:00
Douglas Gregor fa458957ab ENH: Use the HINTS feature of find_library to find the right libraries for
MPI, and act a bit more intelligently when MPI cannot be found.
2008-07-18 08:17:23 -04:00
Douglas Gregor 7e5921eff4 BUG: As a last resort, FindMPI will look for mpi.h in the path 2008-04-22 09:54:23 -04:00
Douglas Gregor cecb98c618 BUG: Use -showme:incdirs and -showme:libdirs when we need them 2008-04-22 09:41:07 -04:00
Douglas Gregor 1100b52c7e ENH: Deal with 32-bit and 64-bit variants of Microsoft's MPI properly 2008-04-10 16:54:20 -04:00
Douglas Gregor 5b3e62c7bc ENH: Enhance FindMPI module by properly handling backward compatibility with the older module, adding documentation, and coping with multiple include and linker paths 2008-03-31 10:55:32 -04:00
Bill Hoffman a8ecf11edf ENH: remove use of undefined cdr 2008-03-24 15:41:16 -04:00
Bill Hoffman 29fe247016 ENH: add new version of FindMPI, fix it to work with MPICH2 on windows 2008-03-07 19:58:29 -05:00