summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/FIND_XXX.txt5
-rw-r--r--Help/command/find_package.rst5
-rw-r--r--Help/release/dev/FindMPI-add-imported-targets.rst4
-rw-r--r--Modules/FindMPI.cmake29
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/CMakeLists.txt2
-rw-r--r--Source/QtDialog/cmake-gui.desktop (renamed from Source/QtDialog/CMake.desktop)0
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindMPI/CMakeLists.txt21
-rw-r--r--Tests/FindMPI/Test/CMakeLists.txt41
-rw-r--r--Tests/FindMPI/Test/main.c7
-rw-r--r--Tests/FindMPI/Test/main.f907
12 files changed, 123 insertions, 4 deletions
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index bd4d295..2f27764 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -73,6 +73,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
1. Search paths specified in cmake-specific cache variables.
These are intended to be used on the command line with a ``-DVAR=value``.
+ The values are interpreted as :ref:`;-lists <CMake Language Lists>`.
This can be skipped if ``NO_CMAKE_PATH`` is passed.
* |CMAKE_PREFIX_PATH_XXX|
@@ -80,7 +81,9 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
* |CMAKE_XXX_MAC_PATH|
2. Search paths specified in cmake-specific environment variables.
- These are intended to be set in the user's shell configuration.
+ These are intended to be set in the user's shell configuration,
+ and therefore use the host's native path separator
+ (``;`` on Windows and ``:`` on UNIX).
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed.
* |CMAKE_PREFIX_PATH_XXX|
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 2cb1e5f..60a77b8 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -251,6 +251,7 @@ enabled.
1. Search paths specified in cmake-specific cache variables. These
are intended to be used on the command line with a ``-DVAR=value``.
+ The values are interpreted as :ref:`;-lists <CMake Language Lists>`.
This can be skipped if ``NO_CMAKE_PATH`` is passed::
CMAKE_PREFIX_PATH
@@ -258,7 +259,9 @@ enabled.
CMAKE_APPBUNDLE_PATH
2. Search paths specified in cmake-specific environment variables.
- These are intended to be set in the user's shell configuration.
+ These are intended to be set in the user's shell configuration,
+ and therefore use the host's native path separator
+ (``;`` on Windows and ``:`` on UNIX).
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed::
<package>_DIR
diff --git a/Help/release/dev/FindMPI-add-imported-targets.rst b/Help/release/dev/FindMPI-add-imported-targets.rst
new file mode 100644
index 0000000..c0a7bfc
--- /dev/null
+++ b/Help/release/dev/FindMPI-add-imported-targets.rst
@@ -0,0 +1,4 @@
+FindMPI-add-imported-targets
+------------------------------
+
+* The :module:`FindMPI` module now provides imported targets.
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index b24b5ef..3e8be5b 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -29,6 +29,12 @@
# MPI_<lang>_LINK_FLAGS Linking flags for MPI programs
# MPI_<lang>_LIBRARIES All libraries to link MPI programs against
#
+# Additionally, the following :prop_tgt:`IMPORTED` targets are defined:
+#
+# ::
+#
+# MPI::MPI_<lang> Target for using MPI from <lang>
+#
# Additionally, FindMPI sets the following variables for running MPI
# programs from the command line:
#
@@ -621,6 +627,29 @@ foreach (lang C CXX Fortran)
else()
find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
endif()
+
+ if(MPI_${lang}_FOUND)
+ if(NOT TARGET MPI::MPI_${lang})
+ add_library(MPI::MPI_${lang} INTERFACE IMPORTED)
+ endif()
+ if(MPI_${lang}_COMPILE_FLAGS)
+ set(_MPI_${lang}_COMPILE_OPTIONS "${MPI_${lang}_COMPILE_FLAGS}")
+ separate_arguments(_MPI_${lang}_COMPILE_OPTIONS)
+ set_property(TARGET MPI::MPI_${lang} PROPERTY
+ INTERFACE_COMPILE_OPTIONS "${_MPI_${lang}_COMPILE_OPTIONS}")
+ endif()
+
+ unset(_MPI_${lang}_LINK_LINE)
+ if(MPI_${lang}_LINK_FLAGS)
+ list(APPEND _MPI_${lang}_LINK_LINE "${MPI_${lang}_LINK_FLAGS}")
+ endif()
+ list(APPEND _MPI_${lang}_LINK_LINE "${MPI_${lang}_LIBRARIES}")
+ set_property(TARGET MPI::MPI_${lang} PROPERTY
+ INTERFACE_LINK_LIBRARIES "${_MPI_${lang}_LINK_LINE}")
+
+ set_property(TARGET MPI::MPI_${lang} PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES "${MPI_${lang}_INCLUDE_PATH}")
+ endif()
endif()
endforeach()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5998240..9219dae 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 8)
-set(CMake_VERSION_PATCH 20170418)
+set(CMake_VERSION_PATCH 20170419)
#set(CMake_VERSION_RC 1)
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 10fd718..2e11a8a 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -198,7 +198,7 @@ if(UNIX AND NOT APPLE)
# install a desktop file so CMake appears in the application start menu
# with an icon
- install(FILES CMake.desktop
+ install(FILES cmake-gui.desktop
DESTINATION "${CMAKE_XDGDATA_DIR}/applications"
${COMPONENT})
install(FILES cmakecache.xml
diff --git a/Source/QtDialog/CMake.desktop b/Source/QtDialog/cmake-gui.desktop
index 842091f..842091f 100644
--- a/Source/QtDialog/CMake.desktop
+++ b/Source/QtDialog/cmake-gui.desktop
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 910ff39..491d974 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1411,6 +1411,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindOpenSSL)
endif()
+ if(CMake_TEST_FindMPI)
+ add_subdirectory(FindMPI)
+ endif()
+
if(CMake_TEST_FindPNG)
add_subdirectory(FindPNG)
endif()
diff --git a/Tests/FindMPI/CMakeLists.txt b/Tests/FindMPI/CMakeLists.txt
new file mode 100644
index 0000000..121d978
--- /dev/null
+++ b/Tests/FindMPI/CMakeLists.txt
@@ -0,0 +1,21 @@
+foreach(c C CXX Fortran)
+ if(CMake_TEST_FindMPI_${c})
+ set(CMake_TEST_FindMPI_FLAG_${c} 1)
+ else()
+ set(CMake_TEST_FindMPI_FLAG_${c} 0)
+ endif()
+endforeach()
+
+add_test(NAME FindMPI.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindMPI/Test"
+ "${CMake_BINARY_DIR}/Tests/FindMPI/Test"
+ ${build_generator_args}
+ --build-project TestFindMPI
+ --build-options ${build_options}
+ -DMPI_TEST_C=${CMake_TEST_FindMPI_FLAG_C}
+ -DMPI_TEST_CXX=${CMake_TEST_FindMPI_FLAG_CXX}
+ -DMPI_TEST_Fortran=${CMake_TEST_FindMPI_FLAG_Fortran}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindMPI/Test/CMakeLists.txt b/Tests/FindMPI/Test/CMakeLists.txt
new file mode 100644
index 0000000..6f177f9
--- /dev/null
+++ b/Tests/FindMPI/Test/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.8)
+project(TestFindMPI)
+include(CTest)
+
+macro(source_code_mapper_helper LANG_NAME)
+ if("${LANG_NAME}" STREQUAL "C")
+ set(MPITEST_SOURCE_FILE "main.c")
+ elseif("${LANG_NAME}" STREQUAL "CXX")
+ configure_file("main.c" "main.cxx" COPYONLY)
+ set(MPITEST_SOURCE_FILE "main.cxx")
+ elseif("${LANG_NAME}" STREQUAL "Fortran")
+ set(MPITEST_SOURCE_FILE "main.f90")
+ endif()
+endmacro()
+
+foreach(c C CXX Fortran)
+ if("${MPI_TEST_${c}}")
+ message("Testing ${c}")
+ enable_language(${c})
+ endif()
+endforeach()
+
+find_package(MPI REQUIRED)
+
+foreach(c C CXX Fortran)
+ if(NOT "${MPI_TEST_${c}}")
+ continue()
+ endif()
+ source_code_mapper_helper(${c})
+ add_executable(test_tgt_${c} ${MPITEST_SOURCE_FILE})
+ target_link_libraries(test_tgt_${c} MPI::MPI_${c})
+ add_test(NAME test_tgt_${c} COMMAND test_tgt_${c})
+
+ add_executable(test_var_${c} ${MPITEST_SOURCE_FILE})
+ target_include_directories(test_var_${c} PRIVATE "${MPI_${c}_INCLUDE_PATH}")
+ target_link_libraries(test_var_${c} PRIVATE "${MPI_${c}_LINK_FLAGS}" "${MPI_${c}_LIBRARIES}")
+ set(copied_MPI_${c}_OPTIONS "${MPI_${c}_COMPILE_FLAGS}")
+ separate_arguments(copied_MPI_${c}_OPTIONS)
+ target_compile_options(test_var_${c} PRIVATE "${copied_MPI_${c}_OPTIONS}")
+ add_test(NAME test_var_${c} COMMAND test_var_${c})
+endforeach()
diff --git a/Tests/FindMPI/Test/main.c b/Tests/FindMPI/Test/main.c
new file mode 100644
index 0000000..7b7f175
--- /dev/null
+++ b/Tests/FindMPI/Test/main.c
@@ -0,0 +1,7 @@
+#include <mpi.h>
+
+int main(int argc, char** argv)
+{
+ MPI_Init(&argc, &argv);
+ MPI_Finalize();
+}
diff --git a/Tests/FindMPI/Test/main.f90 b/Tests/FindMPI/Test/main.f90
new file mode 100644
index 0000000..6fb6fd3
--- /dev/null
+++ b/Tests/FindMPI/Test/main.f90
@@ -0,0 +1,7 @@
+program mpi_test
+ include 'mpif.h'
+ integer ierror
+
+ call MPI_INIT(ierror)
+ call MPI_FINALIZE(ierror)
+end program mpi_test