summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-11-04 18:45:41 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-11-04 18:45:41 (GMT)
commit141383fb261f02c5fab510ffa9b2ff8be11f1cec (patch)
treeafe2beaebfb2aea6750925c64f051a8fa98169de /config/cmake
parent9417e52b8be3453b60f7717ab33d42d7d91784a2 (diff)
downloadhdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.zip
hdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.tar.gz
hdf5-141383fb261f02c5fab510ffa9b2ff8be11f1cec.tar.bz2
[svn-r21717] Update cmake configuration
Update cmake to generate source folders in VS Brought parallel changes from trunk Tested: local linux
Diffstat (limited to 'config/cmake')
-rw-r--r--config/cmake/CPack.cmake509
-rw-r--r--config/cmake/CTest.cmake21
-rw-r--r--config/cmake/ConfigureChecks.cmake4
-rw-r--r--config/cmake/FindMPI.cmake880
-rwxr-xr-xconfig/cmake/cacheinit.cmake6
5 files changed, 605 insertions, 815 deletions
diff --git a/config/cmake/CPack.cmake b/config/cmake/CPack.cmake
index 1f19067..2e6b23a 100644
--- a/config/cmake/CPack.cmake
+++ b/config/cmake/CPack.cmake
@@ -11,13 +11,7 @@
# For certain kinds of binary installers (including the graphical
# installers on Mac OS X and Windows), CPack generates installers that
# allow users to select individual application components to
-# install. The contents of each of the components are identified by
-# the COMPONENT argument of CMake's INSTALL command. These components
-# can be annotated with user-friendly names and descriptions,
-# inter-component dependencies, etc., and grouped in various ways to
-# customize the resulting installer. See the cpack_add_* commands,
-# described below, for more information about component-specific
-# installations.
+# install. See CPackComponent module for that.
#
# The CPACK_GENERATOR variable has different meanings in different
# contexts. In your CMakeLists.txt file, CPACK_GENERATOR is a
@@ -183,93 +177,6 @@
# automatically detected command (or specify its location if the
# auto-detection fails to find it.)
#
-# Installers built on Mac OS X using the Bundle generator use the
-# aforementioned DragNDrop variables, plus the following Bundle-specific
-# parameters:
-#
-# CPACK_BUNDLE_NAME - The name of the generated bundle. This
-# appears in the OSX finder as the bundle name. Required.
-#
-# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used
-# as the Info.plist for the generated bundle. This assumes that
-# the caller has generated or specified their own Info.plist file.
-# Required.
-#
-# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as
-# the icon for the generated bundle. This is the icon that appears
-# in the OSX finder for the bundle, and in the OSX dock when the
-# bundle is opened. Required.
-#
-# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that
-# will be run whenever an end-user double-clicks the generated bundle
-# in the OSX Finder. Optional.
-#
-# The following variables are specific to the graphical installers built
-# on Windows using the Nullsoft Installation System.
-#
-# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when
-# installing this project.
-#
-# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented
-# to the end user by the NSIS installer is under this root dir. The full
-# directory presented to the end user is:
-# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY}
-#
-# CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated
-# install program.
-#
-# CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated
-# uninstall program.
-#
-# CPACK_PACKAGE_ICON - A branding image that will be displayed inside
-# the installer.
-#
-# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will
-# be added to the install Section.
-#
-# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will
-# be added to the uninstall Section.
-#
-# CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the
-# NSIS SetCompressor command.
-#
-# CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page
-# will appear in the installer that will allow the user to choose
-# whether the program directory should be added to the system PATH
-# variable.
-#
-# CPACK_NSIS_DISPLAY_NAME - The display name string that appears in
-# the Windows Add/Remove Program control panel
-#
-# CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the
-# installer.
-#
-# CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that
-# contains the installer icon.
-#
-# CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in
-# installing your application.
-#
-# CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more
-# information about your application.
-#
-# CPACK_NSIS_CONTACT - Contact information for questions and comments
-# about the installation process.
-#
-# CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for
-# creating start menu shortcuts.
-#
-# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
-# uninstall start menu shortcuts.
-#
-# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links
-# assumes that they are in 'bin' unless this variable is set.
-# For example, you would set this to 'exec' if your executables are
-# in an exec directory.
-#
-# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option
-# to run on the finish page of the NSIS installer.
-#
# The following variable is specific to installers build on Mac OS X
# using PackageMaker:
#
@@ -308,196 +215,8 @@
#
# CPACK_INSTALL_COMMANDS - Extra commands to install components.
#
-# CPACK_INSTALL_DIRECTORIES - Extra directories to install.
-#
-# Component-specific installation allows users to select specific sets
-# of components to install during the install process. Installation
-# components are identified by the COMPONENT argument of CMake's
-# INSTALL commands, and should be further described by the following
-# CPack commands:
-#
-# cpack_add_component - Describes a CPack installation component
-# named by the COMPONENT argument to a CMake INSTALL command.
-#
-# cpack_add_component(compname
-# [DISPLAY_NAME name]
-# [DESCRIPTION description]
-# [HIDDEN | REQUIRED | DISABLED ]
-# [GROUP group]
-# [DEPENDS comp1 comp2 ... ]
-# [INSTALL_TYPES type1 type2 ... ]
-# [DOWNLOADED]
-# [ARCHIVE_FILE filename])
-#
-# The cmake_add_component command describes an installation
-# component, which the user can opt to install or remove as part of
-# the graphical installation process. compname is the name of the
-# component, as provided to the COMPONENT argument of one or more
-# CMake INSTALL commands.
-#
-# DISPLAY_NAME is the displayed name of the component, used in
-# graphical installers to display the component name. This value can
-# be any string.
-#
-# DESCRIPTION is an extended description of the component, used in
-# graphical installers to give the user additional information about
-# the component. Descriptions can span multiple lines using "\n" as
-# the line separator. Typically, these descriptions should be no
-# more than a few lines long.
-#
-# HIDDEN indicates that this component will be hidden in the
-# graphical installer, so that the user cannot directly change
-# whether it is installed or not.
-#
-# REQUIRED indicates that this component is required, and therefore
-# will always be installed. It will be visible in the graphical
-# installer, but it cannot be unselected. (Typically, required
-# components are shown greyed out).
-#
-# DISABLED indicates that this component should be disabled
-# (unselected) by default. The user is free to select this component
-# for installation, unless it is also HIDDEN.
-#
-# DEPENDS lists the components on which this component depends. If
-# this component is selected, then each of the components listed
-# must also be selected. The dependency information is encoded
-# within the installer itself, so that users cannot install
-# inconsitent sets of components.
-#
-# GROUP names the component group of which this component is a
-# part. If not provided, the component will be a standalone
-# component, not part of any component group. Component groups are
-# described with the cpack_add_component_group command, detailed
-# below.
-#
-# INSTALL_TYPES lists the installation types of which this component
-# is a part. When one of these installations types is selected, this
-# component will automatically be selected. Installation types are
-# described with the cpack_add_install_type command, detailed below.
-#
-# DOWNLOADED indicates that this component should be downloaded
-# on-the-fly by the installer, rather than packaged in with the
-# installer itself. For more information, see the cpack_configure_downloads
-# command.
-#
-# ARCHIVE_FILE provides a name for the archive file created by CPack
-# to be used for downloaded components. If not supplied, CPack will
-# create a file with some name based on CPACK_PACKAGE_FILE_NAME and
-# the name of the component. See cpack_configure_downloads for more
-# information.
-#
-# cpack_add_component_group - Describes a group of related CPack
-# installation components.
-#
-# cpack_add_component_group(groupname
-# [DISPLAY_NAME name]
-# [DESCRIPTION description]
-# [PARENT_GROUP parent]
-# [EXPANDED]
-# [BOLD_TITLE])
-#
-# The cpack_add_component_group describes a group of installation
-# components, which will be placed together within the listing of
-# options. Typically, component groups allow the user to
-# select/deselect all of the components within a single group via a
-# single group-level option. Use component groups to reduce the
-# complexity of installers with many options. groupname is an
-# arbitrary name used to identify the group in the GROUP argument of
-# the cpack_add_component command, which is used to place a
-# component in a group. The name of the group must not conflict with
-# the name of any component.
-#
-# DISPLAY_NAME is the displayed name of the component group, used in
-# graphical installers to display the component group name. This
-# value can be any string.
-#
-# DESCRIPTION is an extended description of the component group,
-# used in graphical installers to give the user additional
-# information about the components within that group. Descriptions
-# can span multiple lines using "\n" as the line
-# separator. Typically, these descriptions should be no more than a
-# few lines long.
-#
-# PARENT_GROUP, if supplied, names the parent group of this group.
-# Parent groups are used to establish a hierarchy of groups,
-# providing an arbitrary hierarchy of groups.
-#
-# EXPANDED indicates that, by default, the group should show up as
-# "expanded", so that the user immediately sees all of the
-# components within the group. Otherwise, the group will initially
-# show up as a single entry.
-#
-# BOLD_TITLE indicates that the group title should appear in bold,
-# to call the user's attention to the group.
-#
-# cpack_add_install_type - Add a new installation type containing a
-# set of predefined component selections to the graphical installer.
-#
-# cpack_add_install_type(typename
-# [DISPLAY_NAME name])
-#
-# The cpack_add_install_type command identifies a set of preselected
-# components that represents a common use case for an
-# application. For example, a "Developer" install type might include
-# an application along with its header and library files, while an
-# "End user" install type might just include the application's
-# executable. Each component identifies itself with one or more
-# install types via the INSTALL_TYPES argument to
-# cpack_add_component.
-#
-# DISPLAY_NAME is the displayed name of the install type, which will
-# typically show up in a drop-down box within a graphical
-# installer. This value can be any string.
-#
-# cpack_configure_downloads - Configure CPack to download selected
-# components on-the-fly as part of the installation process.
-#
-# cpack_configure_downloads(site
-# [UPLOAD_DIRECTORY dirname]
-# [ALL]
-# [ADD_REMOVE|NO_ADD_REMOVE])
-#
-# The cpack_configure_downloads command configures installation-time
-# downloads of selected components. For each downloadable component,
-# CPack will create an archive containing the contents of that
-# component, which should be uploaded to the given site. When the
-# user selects that component for installation, the installer will
-# download and extract the component in place. This feature is
-# useful for creating small installers that only download the
-# requested components, saving bandwidth. Additionally, the
-# installers are small enough that they will be installed as part of
-# the normal installation process, and the "Change" button in
-# Windows Add/Remove Programs control panel will allow one to add or
-# remove parts of the application after the original
-# installation. On Windows, the downloaded-components functionality
-# requires the ZipDLL plug-in for NSIS, available at:
-#
-# http://nsis.sourceforge.net/ZipDLL_plug-in
-#
-# On Mac OS X, installers that download components on-the-fly can
-# only be built and installed on system using Mac OS X 10.5 or
-# later.
-#
-# The site argument is a URL where the archives for downloadable
-# components will reside, e.g., http://www.cmake.org/files/2.6.1/installer/
-# All of the archives produced by CPack should be uploaded to that location.
-#
-# UPLOAD_DIRECTORY is the local directory where CPack will create the
-# various archives for each of the components. The contents of this
-# directory should be uploaded to a location accessible by the URL given
-# in the site argument. If omitted, CPack will use the directory
-# CPackUploads inside the CMake binary directory to store the generated
-# archives.
-#
-# The ALL flag indicates that all components be downloaded. Otherwise, only
-# those components explicitly marked as DOWNLOADED or that have a specified
-# ARCHIVE_FILE will be downloaded. Additionally, the ALL option implies
-# ADD_REMOVE (unless NO_ADD_REMOVE is specified).
-#
-# ADD_REMOVE indicates that CPack should install a copy of the installer
-# that can be called from Windows' Add/Remove Programs dialog (via the
-# "Modify" button) to change the set of installed components. NO_ADD_REMOVE
-# turns off this behavior. This option is ignored on Mac OS X.
+# CPACK_INSTALLED_DIRECTORIES - Extra directories to install.
+#
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -512,6 +231,13 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# Define this var in order to avoid (or warn) concerning multiple inclusion
+IF(CPack_CMake_INCLUDED)
+ MESSAGE(WARNING "CPack.cmake has already been included!!")
+ELSE(CPack_CMake_INCLUDED)
+ SET(CPack_CMake_INCLUDED 1)
+ENDIF(CPack_CMake_INCLUDED)
+
# Pick a configuration file
SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
@@ -522,214 +248,9 @@ IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
-# Argument-parsing macro from http://www.cmake.org/Wiki/CMakeMacroParseArguments
-MACRO(cpack_parse_arguments prefix arg_names option_names)
- SET(${prefix}_DEFAULT_ARGS)
- FOREACH(arg_name ${arg_names})
- SET(${prefix}_${arg_name})
- ENDFOREACH(arg_name)
- FOREACH(option ${option_names})
- SET(${prefix}_${option} FALSE)
- ENDFOREACH(option)
-
- SET(current_arg_name DEFAULT_ARGS)
- SET(current_arg_list)
- FOREACH(arg ${ARGN})
- SET(larg_names ${arg_names})
- LIST(FIND larg_names "${arg}" is_arg_name)
- IF (is_arg_name GREATER -1)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
- SET(current_arg_name ${arg})
- SET(current_arg_list)
- ELSE (is_arg_name GREATER -1)
- SET(loption_names ${option_names})
- LIST(FIND loption_names "${arg}" is_option)
- IF (is_option GREATER -1)
- SET(${prefix}_${arg} TRUE)
- ELSE (is_option GREATER -1)
- SET(current_arg_list ${current_arg_list} ${arg})
- ENDIF (is_option GREATER -1)
- ENDIF (is_arg_name GREATER -1)
- ENDFOREACH(arg)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
-ENDMACRO(cpack_parse_arguments)
-
-# Macro that appends a SET command for the given variable name (var)
-# to the macro named strvar, but only if the variable named "var"
-# has been defined. The string will eventually be appended to a CPack
-# configuration file.
-MACRO(cpack_append_variable_set_command var strvar)
- IF (DEFINED ${var})
- SET(${strvar} "${${strvar}}SET(${var}")
- FOREACH(APPENDVAL ${${var}})
- SET(${strvar} "${${strvar}} ${APPENDVAL}")
- ENDFOREACH(APPENDVAL)
- SET(${strvar} "${${strvar}})\n")
- ENDIF (DEFINED ${var})
-ENDMACRO(cpack_append_variable_set_command)
-
-# Macro that appends a SET command for the given variable name (var)
-# to the macro named strvar, but only if the variable named "var"
-# has been defined and is a string. The string will eventually be
-# appended to a CPack configuration file.
-MACRO(cpack_append_string_variable_set_command var strvar)
- IF (DEFINED ${var})
- LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
- IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
- SET(${strvar} "${${strvar}}SET(${var} \"${${var}}\")\n")
- ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
- ENDIF (DEFINED ${var})
-ENDMACRO(cpack_append_string_variable_set_command)
-
-# Macro that appends a SET command for the given variable name (var)
-# to the macro named strvar, but only if the variable named "var"
-# has been set to true. The string will eventually be
-# appended to a CPack configuration file.
-MACRO(cpack_append_option_set_command var strvar)
- IF (${var})
- LIST(LENGTH ${var} CPACK_APP_VALUE_LEN)
- IF(${CPACK_APP_VALUE_LEN} EQUAL 1)
- SET(${strvar} "${${strvar}}SET(${var} TRUE)\n")
- ENDIF(${CPACK_APP_VALUE_LEN} EQUAL 1)
- ENDIF (${var})
-ENDMACRO(cpack_append_option_set_command)
-
-# Macro that adds a component to the CPack installer
-MACRO(cpack_add_component compname)
- STRING(TOUPPER ${compname} CPACK_ADDCOMP_UNAME)
- cpack_parse_arguments(CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}
- "DISPLAY_NAME;DESCRIPTION;GROUP;DEPENDS;INSTALL_TYPES;ARCHIVE_FILE"
- "HIDDEN;REQUIRED;DISABLED;DOWNLOADED"
- ${ARGN}
- )
-
- if (CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED)
- SET(CPACK_ADDCOMP_STR "\n# Configuration for downloaded component \"${compname}\"\n")
- else ()
- SET(CPACK_ADDCOMP_STR "\n# Configuration for component \"${compname}\"\n")
- endif ()
-
- IF(NOT CPACK_MONOLITHIC_INSTALL)
- # If the user didn't set CPACK_COMPONENTS_ALL explicitly, update the
- # value of CPACK_COMPONENTS_ALL in the configuration file. This will
- # take care of any components that have been added after the CPack
- # moduled was included.
- IF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
- GET_CMAKE_PROPERTY(CPACK_ADDCOMP_COMPONENTS COMPONENTS)
- SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL")
- FOREACH(COMP ${CPACK_ADDCOMP_COMPONENTS})
- SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR} ${COMP}")
- ENDFOREACH(COMP)
- SET(CPACK_ADDCOMP_STR "${CPACK_ADDCOMP_STR})\n")
- ENDIF(NOT CPACK_COMPONENTS_ALL_SET_BY_USER)
- ENDIF(NOT CPACK_MONOLITHIC_INSTALL)
-
- cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISPLAY_NAME
- CPACK_ADDCOMP_STR)
- cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DESCRIPTION
- CPACK_ADDCOMP_STR)
- cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_GROUP
- CPACK_ADDCOMP_STR)
- cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DEPENDS
- CPACK_ADDCOMP_STR)
- cpack_append_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_INSTALL_TYPES
- CPACK_ADDCOMP_STR)
- cpack_append_string_variable_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_ARCHIVE_FILE
- CPACK_ADDCOMP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_HIDDEN
- CPACK_ADDCOMP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_REQUIRED
- CPACK_ADDCOMP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DISABLED
- CPACK_ADDCOMP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_${CPACK_ADDCOMP_UNAME}_DOWNLOADED
- CPACK_ADDCOMP_STR)
- FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDCOMP_STR}")
-ENDMACRO(cpack_add_component)
-
-# Macro that adds a component group to the CPack installer
-MACRO(cpack_add_component_group grpname)
- STRING(TOUPPER ${grpname} CPACK_ADDGRP_UNAME)
- cpack_parse_arguments(CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}
- "DISPLAY_NAME;DESCRIPTION"
- "EXPANDED;BOLD_TITLE"
- ${ARGN}
- )
-
- SET(CPACK_ADDGRP_STR "\n# Configuration for component group \"${grpname}\"\n")
- cpack_append_string_variable_set_command(
- CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DISPLAY_NAME
- CPACK_ADDGRP_STR)
- cpack_append_string_variable_set_command(
- CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
- CPACK_ADDGRP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
- CPACK_ADDGRP_STR)
- cpack_append_option_set_command(
- CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_BOLD_TITLE
- CPACK_ADDGRP_STR)
- FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_ADDGRP_STR}")
-ENDMACRO(cpack_add_component_group)
-
-# Macro that adds an installation type to the CPack installer
-MACRO(cpack_add_install_type insttype)
- STRING(TOUPPER ${insttype} CPACK_INSTTYPE_UNAME)
- cpack_parse_arguments(CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}
- "DISPLAY_NAME"
- ""
- ${ARGN}
- )
-
- SET(CPACK_INSTTYPE_STR
- "\n# Configuration for installation type \"${insttype}\"\n")
- SET(CPACK_INSTTYPE_STR
- "${CPACK_INSTTYPE_STR}LIST(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n")
- cpack_append_string_variable_set_command(
- CPACK_INSTALL_TYPE_${CPACK_INSTTYPE_UNAME}_DISPLAY_NAME
- CPACK_INSTTYPE_STR)
- FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_INSTTYPE_STR}")
-ENDMACRO(cpack_add_install_type)
-
-MACRO(cpack_configure_downloads site)
- cpack_parse_arguments(CPACK_DOWNLOAD
- "UPLOAD_DIRECTORY"
- "ALL;ADD_REMOVE;NO_ADD_REMOVE"
- ${ARGN}
- )
-
- SET(CPACK_CONFIG_DL_STR
- "\n# Downloaded components configuration\n")
- SET(CPACK_UPLOAD_DIRECTORY ${CPACK_DOWNLOAD_UPLOAD_DIRECTORY})
- SET(CPACK_DOWNLOAD_SITE ${site})
- cpack_append_string_variable_set_command(
- CPACK_DOWNLOAD_SITE
- CPACK_CONFIG_DL_STR)
- cpack_append_string_variable_set_command(
- CPACK_UPLOAD_DIRECTORY
- CPACK_CONFIG_DL_STR)
- cpack_append_option_set_command(
- CPACK_DOWNLOAD_ALL
- CPACK_CONFIG_DL_STR)
- IF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
- SET(CPACK_DOWNLOAD_ADD_REMOVE ON)
- ENDIF (${CPACK_DOWNLOAD_ALL} AND NOT ${CPACK_DOWNLOAD_NO_ADD_REMOVE})
- SET(CPACK_ADD_REMOVE ${CPACK_DOWNLOAD_ADD_REMOVE})
- cpack_append_option_set_command(
- CPACK_ADD_REMOVE
- CPACK_CONFIG_DL_STR)
- FILE(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${CPACK_CONFIG_DL_STR}")
-ENDMACRO(cpack_configure_downloads)
+# Backward compatibility
+# Include CPackComponent macros if it has not already been included before.
+include(CPackComponent)
# Macro for setting values if a user did not overwrite them
MACRO(cpack_set_if_not_set name value)
@@ -739,7 +260,7 @@ MACRO(cpack_set_if_not_set name value)
ENDMACRO(cpack_set_if_not_set)
# Macro to encode variables for the configuration file
-# find any varable that stars with CPACK and create a variable
+# find any variable that starts with CPACK and create a variable
# _CPACK_OTHER_VARIABLES_ that contains SET commands for
# each cpack variable. _CPACK_OTHER_VARIABLES_ is then
# used as an @ replacment in configure_file for the CPackConfig.
@@ -805,7 +326,7 @@ cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME
cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY
"${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
- "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
+ "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true")
diff --git a/config/cmake/CTest.cmake b/config/cmake/CTest.cmake
index 518f61e..c69166c 100644
--- a/config/cmake/CTest.cmake
+++ b/config/cmake/CTest.cmake
@@ -63,7 +63,8 @@ OPTION(BUILD_TESTING "Build the testing tree." ON)
# function to turn generator name into a version string
# like vs7 vs71 vs8 vs9
FUNCTION(GET_VS_VERSION_STRING generator var)
- STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" NUMBER "${generator}")
+ STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1"
+ NUMBER "${generator}")
IF("${generator}" MATCHES "Visual Studio 7 .NET 2003")
SET(ver_string "vs71")
ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003")
@@ -260,15 +261,16 @@ IF(BUILD_TESTING)
ENDIF(CTEST_USE_LAUNCHERS)
MARK_AS_ADVANCED(
+ BZRCOMMAND
+ BZR_UPDATE_OPTIONS
COVERAGE_COMMAND
+ CTEST_SUBMIT_RETRY_DELAY
+ CTEST_SUBMIT_RETRY_COUNT
CVSCOMMAND
- SVNCOMMAND
- BZRCOMMAND
- HGCOMMAND
- GITCOMMAND
CVS_UPDATE_OPTIONS
- SVN_UPDATE_OPTIONS
- BZR_UPDATE_OPTIONS
+ DART_TESTING_TIMEOUT
+ GITCOMMAND
+ HGCOMMAND
MAKECOMMAND
MEMORYCHECK_COMMAND
MEMORYCHECK_SUPPRESSIONS_FILE
@@ -277,10 +279,9 @@ IF(BUILD_TESTING)
SLURM_SBATCH_COMMAND
SLURM_SRUN_COMMAND
SITE
- CTEST_SUBMIT_RETRY_DELAY
- CTEST_SUBMIT_RETRY_COUNT
+ SVNCOMMAND
+ SVN_UPDATE_OPTIONS
)
- # BUILDNAME
IF(NOT RUN_FROM_DART)
SET(RUN_FROM_CTEST_OR_DART 1)
INCLUDE(CTestTargets)
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index be03e52..5ad20a0 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -295,7 +295,6 @@ ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
SET (LINUX_LFS 0)
SET (HDF5_EXTRA_FLAGS)
-#IF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
IF (NOT WINDOWS)
# Linux Specific flags
SET (HDF5_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE)
@@ -303,7 +302,7 @@ IF (NOT WINDOWS)
IF (HDF5_ENABLE_LARGE_FILE)
SET (msg "Performing TEST_LFS_WORKS")
TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
- ${HDF5_BINARY_DIR}/CMake
+ ${CMAKE_BINARY_DIR}
${HDF5_RESOURCES_DIR}/HDF5Tests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
OUTPUT_VARIABLE OUTPUT
@@ -331,7 +330,6 @@ IF (NOT WINDOWS)
ENDIF (HDF5_ENABLE_LARGE_FILE)
SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF5_EXTRA_FLAGS})
ENDIF (NOT WINDOWS)
-#ENDIF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS})
diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake
index 555d2d5..b16c9c3 100644
--- a/config/cmake/FindMPI.cmake
+++ b/config/cmake/FindMPI.cmake
@@ -1,59 +1,70 @@
-# - Message Passing Interface (MPI) module.
-#
+# - Find a Message Passing Interface (MPI) implementation
# The Message Passing Interface (MPI) is a library used to write
-# high-performance parallel applications that use message passing, and
+# high-performance distributed-memory parallel applications, and
# is typically deployed on a cluster. MPI is a standard interface
# (defined by the MPI forum) for which many implementations are
-# available. All of these implementations have somewhat different
-# compilation approaches (different include paths, libraries to link
-# against, etc.), and this module tries to smooth out those differences.
-#
-# This module will set the following variables:
-# MPI_FOUND TRUE if we have found MPI
-# MPI_COMPILE_FLAGS Compilation flags for MPI programs
-# MPI_INCLUDE_PATH Include path(s) for MPI header
-# MPI_LINK_FLAGS Linking flags for MPI programs
-# MPI_LIBRARY First MPI library to link against (cached)
-# MPI_EXTRA_LIBRARY Extra MPI libraries to link against (cached)
-# MPI_LIBRARIES All libraries to link MPI programs against
-# MPIEXEC Executable for running MPI programs
-# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving it the
-# number of processors to run on
-# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly before the
-# executable to run.
-# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after all other flags.
+# available. All of them have somewhat different include paths,
+# libraries to link against, etc., and this module tries to smooth
+# out those differences.
#
-# This module will attempt to auto-detect these settings, first by
-# looking for a MPI compiler, which many MPI implementations provide
-# as a pass-through to the native compiler to simplify the compilation
-# of MPI programs. The MPI compiler is stored in the cache variable
-# MPI_COMPILER, and will attempt to look for commonly-named drivers
-# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and
-# recognized, it will be used to set all of the module variables. To
-# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in
-# the CMake cache.
+# === Variables ===
#
-# If no compiler driver is found or the compiler driver is not
-# recognized, this module will then search for common include paths
-# and library names to try to detect MPI.
+# This module will set the following variables per language in your project,
+# where <lang> is one of C, CXX, or Fortran:
+# MPI_<lang>_FOUND TRUE if FindMPI found MPI flags for <lang>
+# MPI_<lang>_COMPILER MPI Compiler wrapper for <lang>
+# MPI_<lang>_COMPILE_FLAGS Compilation flags for MPI programs
+# MPI_<lang>_INCLUDE_PATH Include path(s) for MPI header
+# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs
+# MPI_<lang>_LIBRARIES All libraries to link MPI programs against
+# Additionally, FindMPI sets the following variables for running MPI
+# programs from the command line:
+# MPIEXEC Executable for running MPI programs
+# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving
+# it the number of processors to run on
+# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly
+# before the executable to run.
+# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags
+# === Usage ===
#
-# If CMake initially finds a different MPI than was intended, and you
-# want to use the MPI compiler auto-detection for a different MPI
-# implementation, set MPI_COMPILER to the MPI compiler driver you want
-# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string
-# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI
-# will run again with the newly-specified MPI_COMPILER.
+# To use this module, simply call FindMPI from a CMakeLists.txt file, or
+# run find_package(MPI), then run CMake. If you are happy with the auto-
+# detected configuration for your language, then you're done. If not, you
+# have two options:
+# 1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your
+# choice and reconfigure. FindMPI will attempt to determine all the
+# necessary variables using THAT compiler's compile and link flags.
+# 2. If this fails, or if your MPI implementation does not come with
+# a compiler wrapper, then set both MPI_<lang>_LIBRARIES and
+# MPI_<lang>_INCLUDE_PATH. You may also set any other variables
+# listed above, but these two are required. This will circumvent
+# autodetection entirely.
+# When configuration is successful, MPI_<lang>_COMPILER will be set to the
+# compiler wrapper for <lang>, if it was found. MPI_<lang>_FOUND and other
+# variables above will be set if any MPI implementation was found for <lang>,
+# regardless of whether a compiler was found.
#
-# When using MPIEXEC to execute MPI applications, you should typically
-# use all of the MPIEXEC flags as follows:
-# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
-# ${MPIEXEC_POSTFLAGS} ARGS
+# When using MPIEXEC to execute MPI applications, you should typically use
+# all of the MPIEXEC flags as follows:
+# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS
+# ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
# where PROCS is the number of processors on which to execute the program,
# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
# MPI program.
+#
+# === Backward Compatibility ===
+#
+# For backward compatibility with older versions of FindMPI, these
+# variables are set, but deprecated:
+# MPI_FOUND MPI_COMPILER MPI_LIBRARY
+# MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY
+# MPI_LINK_FLAGS MPI_LIBRARIES
+# In new projects, please use the MPI_<lang>_XXX equivalents.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2011 Kitware, Inc.
+# Copyright 2010-2011 Todd Gamblin tgamblin@llnl.gov
+# Copyright 2001-2009 Dave Partyka
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -62,303 +73,556 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
+# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-# This module is maintained by David Partyka <dave.partyka@kitware.com>.
+# include this to handle the QUIETLY and REQUIRED arguments
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(GetPrerequisites)
+
+#
+# This part detects MPI compilers, attempting to wade through the mess of compiler names in
+# a sensible way.
+#
+# The compilers are detected in this order:
+#
+# 1. Try to find the most generic availble MPI compiler, as this is usually set up by
+# cluster admins. e.g., if plain old mpicc is available, we'll use it and assume it's
+# the right compiler.
+#
+# 2. If a generic mpicc is NOT found, then we attempt to find one that matches
+# CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc
+# and company, but not mpiicc. This hopefully prevents toolchain mismatches.
+#
+# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you
+# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set
+# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored.
+#
+
+# Start out with the generic MPI compiler names, as these are most commonly used.
+set(_MPI_C_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
+set(_MPI_CXX_COMPILER_NAMES mpicxx mpiCC mpcxx mpCC mpic++ mpc++
+ mpicxx_r mpiCC_r mpcxx_r mpCC_r mpic++_r mpc++_r)
+set(_MPI_Fortran_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
+ mpif90 mpif90_r mpf90 mpf90_r
+ mpif77 mpif77_r mpf77 mpf77_r)
+
+# GNU compiler names
+set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
+set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r)
+set(_MPI_GNU_Fortran_COMPILER_NAMES mpigfortran mpgfortran mpigfortran_r mpgfortran_r
+ mpig77 mpig77_r mpg77 mpg77_r)
+
+# Intel MPI compiler names
+set(_MPI_Intel_C_COMPILER_NAMES mpiicc)
+set(_MPI_Intel_CXX_COMPILER_NAMES mpiicpc mpiicxx mpiic++ mpiiCC)
+set(_MPI_Intel_Fortran_COMPILER_NAMES mpiifort mpiif95 mpiif90 mpiif77)
+
+# PGI compiler names
+set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc)
+set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC)
+set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77)
+
+# XLC MPI Compiler names
+set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r)
+set(_MPI_XL_CXX_COMPILER_NAMES mpixlcxx mpixlC mpixlc++ mpxlcxx mpxlc++ mpixlc++ mpxlCC
+ mpixlcxx_r mpixlC_r mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r)
+set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95_r
+ mpixlf90 mpixlf90_r mpxlf90 mpxlf90_r
+ mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r
+ mpixlf mpixlf_r mpxlf mpxlf_r)
+
+# append vendor-specific compilers to the list if we either don't know the compiler id,
+# or if we know it matches the regular compiler.
+foreach (lang C CXX Fortran)
+ foreach (id GNU Intel PGI XL)
+ if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}")
+ list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
+ endif()
+ unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here
+ endforeach()
+endforeach()
-# A set of directories to search through in addition to the standard system paths
-# that find_program will search through.
-# Microsoft HPC SDK is automatically added to the system path
-# Argonne National Labs MPICH2 sets a registry key that we can use.
-set(_MPI_PACKAGE_DIR
- mpi
- mpich
- openmpi
- lib/mpi
- lib/mpich
- lib/openmpi
- "MPICH/SDK"
- "Microsoft Compute Cluster Pack"
- )
+# Names to try for MPI exec
+set(_MPI_EXEC_NAMES mpiexec mpirun lamexec srun)
+# Grab the path to MPI from the registry if we're on windows.
set(_MPI_PREFIX_PATH)
if(WIN32)
list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
+ list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/")
endif()
+# Build a list of prefixes to search for MPI.
foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
endif()
- endforeach(MpiPackageDir)
-endforeach(SystemPrefixDir)
+ endforeach()
+endforeach()
+
+
+#
+# interrogate_mpi_compiler(lang try_libs)
+#
+# Attempts to extract compiler and linker args from an MPI compiler. The arguments set
+# by this function are:
+#
+# MPI_<lang>_INCLUDE_PATH MPI_<lang>_LINK_FLAGS MPI_<lang>_FOUND
+# MPI_<lang>_COMPILE_FLAGS MPI_<lang>_LIBRARIES
+#
+# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for
+# <lang>. Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set
+# to skip autodetection.
+#
+# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual
+# way. In general, this is not as effective as interrogating the compilers, as it
+# ignores language-specific flags and libraries. However, some MPI implementations
+# (Windows implementations) do not have compiler wrappers, so this approach must be used.
+#
+function (interrogate_mpi_compiler lang try_libs)
+ # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was
+ # discovered to be the MPI compiler. This happens on machines like the Cray XE6 that use
+ # modules to set cc, CC, and ftn to the MPI compilers. If the user force-sets another MPI
+ # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll
+ # inspect that compiler anew. This allows users to set new compilers w/o rm'ing cache.
+ string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate)
+
+ # If MPI is set already in the cache, don't bother with interrogating the compiler.
+ if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES)))
+ if (MPI_${lang}_COMPILER)
+ # Check whether the -showme:compile option works. This indicates that we have either OpenMPI
+ # or a newer version of LAM-MPI, and implies that -showme:link will also work.
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:compile
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # If we appear to have -showme:compile, then we should
+ # also have -showme:link. Try it.
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:link
+ OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # We probably have -showme:incdirs and -showme:libdirs as well,
+ # so grab that while we're at it.
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs
+ OUTPUT_VARIABLE MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs
+ OUTPUT_VARIABLE MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+ else()
+ # reset things here if something went wrong.
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+ endif ()
+
+ # Older versions of LAM-MPI have "-showme". Try to find that.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -showme
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+ endif()
+
+ # MVAPICH uses -compile-info and -link-info. Try them.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -compile-info
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+
+ # If we have compile-info, also have link-info.
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -link-info
+ OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+ endif()
+
+ # make sure we got compile and link. Reset vars if something's wrong.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+ endif()
+
+ # MPICH just uses "-show". Try it.
+ if (NOT MPI_COMPILER_RETURN EQUAL 0)
+ execute_process(
+ COMMAND ${MPI_${lang}_COMPILER} -show
+ OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE MPI_COMPILER_RETURN)
+ endif()
+
+ if (MPI_COMPILER_RETURN EQUAL 0)
+ # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
+ # into MPI_LINK_CMDLINE, if we didn't find the link line.
+ if (NOT MPI_LINK_CMDLINE)
+ set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+ endif()
+ else()
+ message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}")
+ set(MPI_COMPILE_CMDLINE)
+ set(MPI_LINK_CMDLINE)
+ endif()
+
+ # Here, we're done with the interrogation part, and we'll try to extract args we care
+ # about from what we learned from the compiler wrapper scripts.
+
+ # If interrogation came back with something, extract our variable from the MPI command line
+ if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE)
+ # Extract compile flags from the compile command line.
+ string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+ set(MPI_COMPILE_FLAGS_WORK)
+
+ foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+ if (MPI_COMPILE_FLAGS_WORK)
+ set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+ else()
+ set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+ endif()
+ endforeach()
+
+ # Extract include paths from compile command line
+ string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+ foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+ string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
+ string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+ list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+ endforeach()
+
+ # try using showme:incdirs if extracting didn't work.
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS})
+ separate_arguments(MPI_INCLUDE_PATH_WORK)
+ endif()
+
+ # If all else fails, just search for mpi.h in the normal include paths.
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_path(MPI_HEADER_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+ endif()
+
+ # Extract linker paths from the link command line
+ string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_PATH)
+ foreach(LPATH ${MPI_ALL_LINK_PATHS})
+ string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
+ string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+ list(APPEND MPI_LINK_PATH ${LPATH})
+ endforeach()
+
+ # try using showme:libdirs if extracting didn't work.
+ if (NOT MPI_LINK_PATH)
+ set(MPI_LINK_PATH ${MPI_LIBDIRS})
+ separate_arguments(MPI_LINK_PATH)
+ endif()
+
+ # Extract linker flags from the link command line
+ string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+ set(MPI_LINK_FLAGS_WORK)
+ foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+ if (MPI_LINK_FLAGS_WORK)
+ set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+ else()
+ set(MPI_LINK_FLAGS_WORK ${FLAG})
+ endif()
+ endforeach()
+
+ # Extract the set of libraries to link against from the link command
+ # line
+ string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+ # Determine full path names for all of the libraries that one needs
+ # to link against in an MPI program
+ foreach(LIB ${MPI_LIBNAMES})
+ string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
+ # MPI_LIB is cached by find_library, but we don't want that. Clear it first.
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})
+
+ if (MPI_LIB)
+ list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+ elseif (NOT MPI_FIND_QUIETLY)
+ message(WARNING "Unable to find MPI library ${LIB}")
+ endif()
+ endforeach()
+
+ # Sanity check MPI_LIBRARIES to make sure there are enough libraries
+ list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS)
+ list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+ if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ endif()
+ endif()
+
+ elseif(try_libs)
+ # If we didn't have an MPI compiler script to interrogate, attempt to find everything
+ # with plain old find functions. This is nasty because MPI implementations have LOTS of
+ # different library names, so this section isn't going to be very generic. We need to
+ # make sure it works for MS MPI, though, since there are no compiler wrappers for that.
+ find_path(MPI_HEADER_PATH mpi.h
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES include Inc)
+ set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+
+ # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ set(MS_MPI_ARCH_DIR amd64)
+ else()
+ set(MS_MPI_ARCH_DIR i386)
+ endif()
+
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB
+ NAMES mpi mpich mpich2 msmpi
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR})
+ set(MPI_LIBRARIES_WORK ${MPI_LIB})
+
+ # Right now, we only know about the extra libs for C++.
+ # We could add Fortran here (as there is usually libfmpich, etc.), but
+ # this really only has to work with MS MPI on Windows.
+ # Assume that other MPI's are covered by the compiler wrappers.
+ if (${lang} STREQUAL CXX)
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB
+ NAMES mpi++ mpicxx cxx mpi_cxx
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib)
+ if (MPI_LIBRARIES_WORK AND MPI_LIB)
+ set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+ endif()
+ endif()
+
+ if (${lang} STREQUAL Fortran)
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ find_library(MPI_LIB
+ NAMES fmpi fmpich fmpich2 fmpich2g
+ HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib)
+ if (MPI_LIBRARIES_WORK AND MPI_LIB)
+ set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+ endif()
+ endif()
+
+ if (NOT MPI_LIBRARIES_WORK)
+ set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+ endif()
+ endif()
+
+ # If we found MPI, set up all of the appropriate cache entries
+ set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags" FORCE)
+ set(MPI_${lang}_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI ${lang} include path" FORCE)
+ set(MPI_${lang}_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI ${lang} linking flags" FORCE)
+ set(MPI_${lang}_LIBRARIES ${MPI_LIBRARIES_WORK} CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+ mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES)
+
+ # clear out our temporary lib/header detectionv variable here.
+ set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI lib detection" FORCE)
+ set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE)
+ endif()
+
+ # finally set a found variable for each MPI language
+ if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES)
+ set(MPI_${lang}_FOUND TRUE PARENT_SCOPE)
+ else()
+ set(MPI_${lang}_FOUND FALSE PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+# This function attempts to compile with the regular compiler, to see if MPI programs
+# work with it. This is a last ditch attempt after we've tried interrogating mpicc and
+# friends, and after we've tried to find generic libraries. Works on machines like
+# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
+function(try_regular_compiler lang success)
+ set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+ if (${lang} STREQUAL Fortran)
+ set(test_file ${scratch_directory}/cmake_mpi_test.f90)
+ file(WRITE ${test_file}
+ "program hello\n"
+ "include 'mpif.h'\n"
+ "integer ierror\n"
+ "call MPI_INIT(ierror)\n"
+ "call MPI_FINALIZE(ierror)\n"
+ "end\n")
+ else()
+ if (${lang} STREQUAL CXX)
+ set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
+ else()
+ set(test_file ${scratch_directory}/cmake_mpi_test.c)
+ endif()
+ file(WRITE ${test_file}
+ "#include <mpi.h>\n"
+ "int main(int argc, char **argv) {\n"
+ " MPI_Init(&argc, &argv);\n"
+ " MPI_Finalize();\n"
+ "}\n")
+ endif()
+ try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
+ if (compiler_has_mpi)
+ set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
+ set(MPI_${lang}_COMPILER ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler" FORCE)
+ set(MPI_${lang}_COMPILE_FLAGS "" CACHE STRING "MPI ${lang} compilation flags" FORCE)
+ set(MPI_${lang}_INCLUDE_PATH "" CACHE STRING "MPI ${lang} include path" FORCE)
+ set(MPI_${lang}_LINK_FLAGS "" CACHE STRING "MPI ${lang} linking flags" FORCE)
+ set(MPI_${lang}_LIBRARIES "" CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+ endif()
+ set(${success} ${compiler_has_mpi} PARENT_SCOPE)
+ unset(compiler_has_mpi CACHE)
+endfunction()
+
+# End definitions, commence real work here.
# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
find_program(MPIEXEC
- NAMES mpiexec mpirun lamexec
+ NAMES ${_MPI_EXEC_NAMES}
PATHS ${_MPI_PREFIX_PATH}
PATH_SUFFIXES bin
- DOC "Executable for running MPI programs."
- )
+ DOC "Executable for running MPI programs.")
# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
-# If there is an mpi compiler find it and interogate (farther below) it for the include
-# and lib dirs otherwise we will continue to search from ${_MPI_BASE_DIR}.
-find_program(MPI_COMPILER
- NAMES mpiCC mpicc mpic++ mpicxx
- HINTS "${_MPI_BASE_DIR}"
- PATH_SUFFIXES bin
- DOC "MPI compiler. Used only to detect MPI compilation flags.")
-mark_as_advanced(MPI_COMPILER)
-
set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
-set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
-set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
-set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
-mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS
- MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
- # the cache, and we don't want to override those settings.
-elseif (MPI_COMPILER)
- # Check whether the -showme:compile option works. This indicates
- # that we have either Open MPI or a newer version of LAM-MPI, and
- # implies that -showme:link will also work.
- # Note that Windows distros do not have an mpi compiler to interogate.
- exec_program(${MPI_COMPILER}
- ARGS -showme:compile
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # If we appear to have -showme:compile, then we should also have
- # -showme:link. Try it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:link
- OUTPUT_VARIABLE MPI_LINK_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
-
- # Note that we probably have -showme:incdirs and -showme:libdirs
- # as well.
- set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # Do nothing: we have our command lines now
- else (MPI_COMPILER_RETURN EQUAL 0)
- # Older versions of LAM-MPI have "-showme". Try it.
- exec_program(${MPI_COMPILER}
- ARGS -showme
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # Do nothing: we have our command lines now
- else (MPI_COMPILER_RETURN EQUAL 0)
- # MPICH uses "-show". Try it.
- exec_program(${MPI_COMPILER}
- ARGS -show
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # We have our command lines, but we might need to copy
- # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying
- if (NOT MPI_LINK_CMDLINE)
- SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
- endif (NOT MPI_LINK_CMDLINE)
- else (MPI_COMPILER_RETURN EQUAL 0)
- message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
- endif (MPI_COMPILER_RETURN EQUAL 0)
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
- # the cache, and we don't want to override those settings.
-elseif (MPI_COMPILE_CMDLINE)
- # Extract compile flags from the compile command line.
- string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
- set(MPI_COMPILE_FLAGS_WORK)
- foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
- if (MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
- else(MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK ${FLAG})
- endif(MPI_COMPILE_FLAGS_WORK)
- endforeach(FLAG)
-
- # Extract include paths from compile command line
- string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
- set(MPI_INCLUDE_PATH_WORK)
- foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
- string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
- string(REGEX REPLACE "//" "/" IPATH ${IPATH})
- list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
- endforeach(IPATH)
-
- if (NOT MPI_INCLUDE_PATH_WORK)
- if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- # The compile command line didn't have any include paths on it,
- # but we may have -showme:incdirs. Use it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:incdirs
- OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
- RETURN_VALUE MPI_COMPILER_RETURN)
- separate_arguments(MPI_INCLUDE_PATH_WORK)
- endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- endif (NOT MPI_INCLUDE_PATH_WORK)
-
- if (NOT MPI_INCLUDE_PATH_WORK)
- # If all else fails, just search for mpi.h in the normal include
- # paths.
- find_path(MPI_INCLUDE_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include
- )
- set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
- endif (NOT MPI_INCLUDE_PATH_WORK)
-
- # Extract linker paths from the link command line
- string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_PATH)
- foreach(LPATH ${MPI_ALL_LINK_PATHS})
- string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
- string(REGEX REPLACE "//" "/" LPATH ${LPATH})
- list(APPEND MPI_LINK_PATH ${LPATH})
- endforeach(LPATH)
-
- if (NOT MPI_LINK_PATH)
- if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- # The compile command line didn't have any linking paths on it,
- # but we may have -showme:libdirs. Use it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:libdirs
- OUTPUT_VARIABLE MPI_LINK_PATH
- RETURN_VALUE MPI_COMPILER_RETURN)
- separate_arguments(MPI_LINK_PATH)
- endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- endif (NOT MPI_LINK_PATH)
-
- # Extract linker flags from the link command line
- string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_FLAGS_WORK)
- foreach(FLAG ${MPI_ALL_LINK_FLAGS})
- if (MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
- else(MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK ${FLAG})
- endif(MPI_LINK_FLAGS_WORK)
- endforeach(FLAG)
-
- # Extract the set of libraries to link against from the link command
- # line
- string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
-
- # Determine full path names for all of the libraries that one needs
- # to link against in an MPI program
- set(MPI_LIBRARIES)
- foreach(LIB ${MPI_LIBNAMES})
- string(REGEX REPLACE "^-l" "" LIB ${LIB})
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
- if (MPI_LIB)
- list(APPEND MPI_LIBRARIES ${MPI_LIB})
- else (MPI_LIB)
- message(SEND_ERROR "Unable to find MPI library ${LIB}")
- endif (MPI_LIB)
- endforeach(LIB)
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
-
- # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
- # MPI_EXTRA_LIBRARY.
- list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
- list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
- if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
- set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
- else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
- endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- if (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
- list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
- set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
- else (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
- endif (MPI_NUMLIBS GREATER 1)
-
- # Set up all of the appropriate cache entries
- set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE)
- set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
- set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
-else (MPI_COMPILE_CMDLINE)
-# No MPI compiler to interogate so attempt to find everything with find functions.
- find_path(MPI_INCLUDE_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include
- )
-
- # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- set(MS_MPI_ARCH_DIR amd64)
- else()
- set(MS_MPI_ARCH_DIR i386)
+set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+
+#=============================================================================
+# Backward compatibility input hacks. Propagate the FindMPI hints to C and
+# CXX if the respective new versions are not defined. Translate the old
+# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES.
+#
+# Once we find the new variables, we translate them back into their old
+# equivalents below.
+foreach (lang C CXX)
+ # Old input variables.
+ set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
+
+ # Set new vars based on their old equivalents, if the new versions are not already set.
+ foreach (var ${_MPI_OLD_INPUT_VARS})
+ if (NOT MPI_${lang}_${var} AND MPI_${var})
+ set(MPI_${lang}_${var} "${MPI_${var}}")
+ endif()
+ endforeach()
+
+ # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the
+ # new FindMPI. These need to be merged into MPI_<lang>_LIBRARIES
+ if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY))
+ set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+ endif()
+endforeach()
+#=============================================================================
+
+
+# This loop finds the compilers and sends them off for interrogation.
+foreach (lang C CXX Fortran)
+ if (CMAKE_${lang}_COMPILER_WORKS)
+ # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
+ if (MPI_${lang}_COMPILER)
+ is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE)
+ if (NOT MPI_COMPILER_IS_EXECUTABLE)
+ # Get rid of our default list of names and just search for the name the user wants.
+ set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER})
+ set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+ # If the user specifies a compiler, we don't want to try to search libraries either.
+ set(try_libs FALSE)
+ endif()
+ else()
+ set(try_libs TRUE)
+ endif()
+
+ find_program(MPI_${lang}_COMPILER
+ NAMES ${_MPI_${lang}_COMPILER_NAMES}
+ PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+ interrogate_mpi_compiler(${lang} ${try_libs})
+ mark_as_advanced(MPI_${lang}_COMPILER)
+
+ # last ditch try -- if nothing works so far, just try running the regular compiler and
+ # see if we can create an MPI executable.
+ set(regular_compiler_worked 0)
+ if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH)
+ try_regular_compiler(${lang} regular_compiler_worked)
+ endif()
+
+ if (regular_compiler_worked)
+ find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER)
+ else()
+ find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
+ endif()
endif()
+endforeach()
- find_library(MPI_LIBRARY
- NAMES mpi mpich msmpi
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}
- )
-
- find_library(MPI_EXTRA_LIBRARY
- NAMES mpi++
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib
- DOC "Extra MPI libraries to link against.")
-
- set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
- set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
-
-# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
-if("${MPI_LIBRARY}" MATCHES "mpich.rts")
- set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
- set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
-endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
-
-# Set up extra variables to conform to
-if (MPI_EXTRA_LIBRARY)
- set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
-else (MPI_EXTRA_LIBRARY)
- set(MPI_LIBRARIES ${MPI_LIBRARY})
-endif (MPI_EXTRA_LIBRARY)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- set(MPI_FOUND TRUE)
-else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+#=============================================================================
+# More backward compatibility stuff
+#
+# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found.
+# This mimics the behavior of the old language-oblivious FindMPI.
+set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
+if (MPI_CXX_FOUND)
+ foreach (var ${_MPI_OLD_VARS})
+ set(MPI_${var} ${MPI_CXX_${var}})
+ endforeach()
+elseif (MPI_C_FOUND)
+ foreach (var ${_MPI_OLD_VARS})
+ set(MPI_${var} ${MPI_C_${var}})
+ endforeach()
+else()
+ # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND
set(MPI_FOUND FALSE)
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+endif()
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments
-find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
+# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
+if (MPI_LIBRARIES)
+ list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+ set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+else()
+ set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+endif()
-mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY
- MPI_EXTRA_LIBRARY)
+list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+if (MPI_NUMLIBS GREATER 1)
+ set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+ list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+ set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+else()
+ set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+endif()
+#=============================================================================
-# unset to cleanup namespace
-unset(_MPI_PACKAGE_DIR)
+# unset these vars to cleanup namespace
+unset(_MPI_OLD_VARS)
unset(_MPI_PREFIX_PATH)
unset(_MPI_BASE_DIR)
+foreach (lang C CXX Fortran)
+ unset(_MPI_${lang}_COMPILER_NAMES)
+endforeach()
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index 1aa4aa2..b49df17 100755
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -32,18 +32,24 @@ SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API
SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+
SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
SET (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE)
SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+SET (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE)
+
SET (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE)
SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE)
SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+SET (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
+
SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)