On 21 August 2012 07:52, Johannes Ring <[email protected]> wrote: > The MPI_<lang>_* variables was not available before CMake 2.8.5, so we > should either require 2.8.5 or do something like this: > > if ("${CMAKE_VERSION}" VERSION_GREATER "2.8.4") > set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} > ${MPI_CXX_INCLUDE_PATH}) > ... > else() > set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_INCLUDE_PATH}) > ... > endif() > > It is fine by me if we require 2.8.5. >
We can just copy a recent FindMPI.cmake into cmake/modules. Garth > Johannes > > On Mon, Aug 20, 2012 at 9:30 PM, <[email protected]> wrote: >> Merge authors: >> Garth Wells (garth-wells) >> ------------------------------------------------------------ >> revno: 6846 [merge] >> committer: Garth N. Wells <[email protected]> >> branch nick: dolfin >> timestamp: Mon 2012-08-20 20:23:20 +0100 >> message: >> merge >> modified: >> CMakeLists.txt >> cmake/modules/FindPETSc.cmake >> cmake/modules/FindPaStiX.cmake >> cmake/modules/FindParMETIS.cmake >> cmake/modules/FindSLEPc.cmake >> cmake/modules/FindScotchPT.cmake >> dolfin/CMakeLists.txt >> >> >> -- >> lp:dolfin >> https://code.launchpad.net/~dolfin-core/dolfin/trunk >> >> Your team DOLFIN Core Team is subscribed to branch lp:dolfin. >> To unsubscribe from this branch go to >> https://code.launchpad.net/~dolfin-core/dolfin/trunk/+edit-subscription >> >> === modified file 'CMakeLists.txt' >> --- CMakeLists.txt 2012-08-16 13:16:59 +0000 >> +++ CMakeLists.txt 2012-08-20 19:16:51 +0000 >> @@ -199,7 +199,7 @@ >> set(Boost_USE_MULTITHREADED $ENV{BOOST_USE_MULTITHREADED}) >> set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0 1.44 1.44.0 1.45 1.45.0 1.46 >> 1.46.0 1.46.1 1.47 1.47.0 1.48 1.48.0 1.49 1.49.0 1.50 1.50.0) >> >> -if (DOLFIN_ENABLE_MPI AND MPI_FOUND) >> +if (DOLFIN_ENABLE_MPI AND MPI_CXX_FOUND) >> find_package(Boost 1.36 COMPONENTS filesystem program_options system >> thread iostreams math_tr1 mpi serialization REQUIRED) >> else() >> find_package(Boost 1.36 COMPONENTS filesystem program_options system >> thread iostreams math_tr1 REQUIRED) >> @@ -242,7 +242,7 @@ >> endif() >> >> # Check for ParMETIS and SCOTCH >> -if (DOLFIN_ENABLE_MPI AND MPI_FOUND) >> +if (DOLFIN_ENABLE_MPI AND MPI_C_FOUND) >> if (DOLFIN_ENABLE_PARMETIS) >> find_package(ParMETIS) >> endif() >> >> === modified file 'cmake/modules/FindPETSc.cmake' >> --- cmake/modules/FindPETSc.cmake 2012-02-29 14:08:53 +0000 >> +++ cmake/modules/FindPETSc.cmake 2012-08-20 19:16:51 +0000 >> @@ -6,7 +6,7 @@ >> # PETSC_LIBRARIES - libraries for PETSc >> # PETSC_DIR - directory where PETSc is built >> # PETSC_ARCH - architecture for which PETSc is built >> -# PETSC_CUSP_FOUND - PETSc has Cusp support >> +# PETSC_CUSP_FOUND - PETSc has Cusp support >> # >> # This config script is (very loosley) based on a PETSc CMake script by Jed >> Brown. >> >> @@ -148,7 +148,7 @@ >> petsc_get_variable(PETSC_LIB_BASIC PETSC_LIB_BASIC) >> petsc_get_variable(PETSC_LIB_DIR PETSC_LIB_DIR) >> set(PETSC_LIB "-L${PETSC_LIB_DIR} ${PETSC_LIB_BASIC}") >> - >> + >> # Remove temporary Makefile >> file(REMOVE ${petsc_config_makefile}) >> >> @@ -179,10 +179,10 @@ >> set(CMAKE_REQUIRED_LIBRARIES ${PETSC_LIBRARIES}) >> >> # Add MPI variables if MPI has been found >> - if (MPI_FOUND) >> - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_INCLUDE_PATH}) >> - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_LIBRARIES}) >> - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_COMPILE_FLAGS}") >> + if (MPI_C_FOUND) >> + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_C_INCLUDE_PATH}) >> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_C_LIBRARIES}) >> + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_C_COMPILE_FLAGS}") >> endif() >> >> # Run PETSc test program >> >> === modified file 'cmake/modules/FindPaStiX.cmake' >> --- cmake/modules/FindPaStiX.cmake 2012-08-01 21:52:00 +0000 >> +++ cmake/modules/FindPaStiX.cmake 2012-08-20 19:16:51 +0000 >> @@ -20,22 +20,24 @@ >> ) >> >> # Check for rt library >> -find_library(RT_LIBRARY rt >> - DOC "The RT library" >> - ) >> - >> -# Check for hwloc header >> -find_library(RT_LIBRARY rt >> - DOC "The RT library" >> - ) >> - >> -# Check for hwloc header >> -find_path(HWLOC_INCLUDE_DIRS pastix.h >> +#find_library(RT_LIBRARY rt >> +# DOC "The RT library" >> +# ) >> + >> +# Check for rt header >> +#find_library(RT_LIBRARY rt >> +# DOC "The RT library" >> +# ) >> + >> +# Check for hwloc header >> +find_path(HWLOC_INCLUDE_DIRS hwloc.h >> + HINTS ${HWLOC_DIR} $ENV{HWLOC_DIR} ${HWLOC_DIR}/include >> $ENV{HWLOC_DIR}/include >> DOC "Directory where the hwloc header is located" >> ) >> >> # Check for hwloc library >> find_library(HWLOC_LIBRARY hwloc >> + HINTS ${HWLOC_DIR} $ENV{HWLOC_DIR} ${HWLOC_DIR}/lib $ENV{HWLOC_DIR}/lib >> DOC "The hwloc library" >> ) >> >> @@ -44,7 +46,8 @@ >> find_package(BLAS) >> >> # Collect libraries >> -set(PASTIX_LIBRARIES ${PASTIX_LIBRARY} ${RT_LIBRARY} ${HWLOC_LIBRARY} >> ${BLAS_LIBRARIES}) >> +#set(PASTIX_LIBRARIES ${PASTIX_LIBRARY} ${RT_LIBRARY} ${HWLOC_LIBRARY} >> ${BLAS_LIBRARIES}) >> +set(PASTIX_LIBRARIES ${PASTIX_LIBRARY} ${HWLOC_LIBRARY} ${BLAS_LIBRARIES}) >> >> find_program(GFORTRAN_EXECUTABLE gfortran) >> if (GFORTRAN_EXECUTABLE) >> @@ -70,10 +73,10 @@ >> set(CMAKE_REQUIRED_LIBRARIES ${PASTIX_LIBRARIES}) >> >> # Add MPI variables if MPI has been found >> - if (MPI_FOUND) >> - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_INCLUDE_PATH}) >> - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_LIBRARIES}) >> - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_COMPILE_FLAGS}") >> + if (MPI_C_FOUND) >> + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_C_INCLUDE_PATH}) >> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_C_LIBRARIES}) >> + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_C_COMPILE_FLAGS}") >> endif() >> >> # Add SCOTCH variables if SCOTCH has been found >> >> === modified file 'cmake/modules/FindParMETIS.cmake' >> --- cmake/modules/FindParMETIS.cmake 2012-07-20 21:12:39 +0000 >> +++ cmake/modules/FindParMETIS.cmake 2012-08-20 19:16:51 +0000 >> @@ -34,7 +34,7 @@ >> # POSSIBILITY OF SUCH DAMAGE. >> >> #============================================================================= >> >> -if (MPI_FOUND) >> +if (MPI_CXX_FOUND) >> find_path(PARMETIS_INCLUDE_DIRS parmetis.h >> HINTS ${PARMETIS_DIR}/include $ENV{PARMETIS_DIR}/include >> DOC "Directory where the ParMETIS header files are located" >> @@ -59,8 +59,8 @@ >> if (PARMETIS_INCLUDE_DIRS AND PARMETIS_LIBRARY) >> >> # Set flags for building test program >> - set(CMAKE_REQUIRED_INCLUDES ${PARMETIS_INCLUDE_DIRS} >> ${MPI_INCLUDE_PATH}) >> - set(CMAKE_REQUIRED_LIBRARIES ${PARMETIS_LIBRARIES} ${MPI_LIBRARIES}) >> + set(CMAKE_REQUIRED_INCLUDES ${PARMETIS_INCLUDE_DIRS} >> ${MPI_CXX_INCLUDE_PATH}) >> + set(CMAKE_REQUIRED_LIBRARIES ${PARMETIS_LIBRARIES} >> ${MPI_CXX_LIBRARIES}) >> >> # Build and run test program >> include(CheckCXXSourceRuns) >> >> === modified file 'cmake/modules/FindSLEPc.cmake' >> --- cmake/modules/FindSLEPc.cmake 2012-02-22 14:53:14 +0000 >> +++ cmake/modules/FindSLEPc.cmake 2012-08-20 19:16:51 +0000 >> @@ -130,10 +130,10 @@ >> set(CMAKE_REQUIRED_LIBRARIES ${SLEPC_LIBRARIES} ${PETSC_LIBRARIES}) >> >> # Add MPI variables if MPI has been found >> - if (MPI_FOUND) >> - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_INCLUDE_PATH}) >> - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_LIBRARIES}) >> - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_COMPILE_FLAGS}") >> + if (MPI_C_FOUND) >> + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_C_INCLUDE_PATH}) >> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_C_LIBRARIES}) >> + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_C_COMPILE_FLAGS}") >> endif() >> >> # Run SLEPc test program >> >> === modified file 'cmake/modules/FindScotchPT.cmake' >> --- cmake/modules/FindScotchPT.cmake 2012-07-20 21:12:39 +0000 >> +++ cmake/modules/FindScotchPT.cmake 2012-08-20 19:16:51 +0000 >> @@ -98,10 +98,10 @@ >> set(CMAKE_REQUIRED_LIBRARIES ${SCOTCH_LIBRARIES}) >> >> # Add MPI variables if MPI has been found >> - if (MPI_FOUND) >> - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_INCLUDE_PATH}) >> - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_LIBRARIES}) >> - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_COMPILE_FLAGS}") >> + if (MPI_CXX_FOUND) >> + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} >> ${MPI_CXX_INCLUDE_PATH}) >> + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} >> ${MPI_CXX_LIBRARIES}) >> + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} >> ${MPI_CXX_COMPILE_FLAGS}") >> endif() >> >> set(SCOTCH_CONFIG_TEST_VERSION_CPP >> >> === modified file 'dolfin/CMakeLists.txt' >> --- dolfin/CMakeLists.txt 2012-07-20 21:12:39 +0000 >> +++ dolfin/CMakeLists.txt 2012-08-20 19:16:51 +0000 >> @@ -176,15 +176,15 @@ >> endif() >> >> # MPI >> -if (DOLFIN_ENABLE_MPI AND MPI_FOUND) >> +if (DOLFIN_ENABLE_MPI AND MPI_CXX_FOUND) >> list(APPEND DOLFIN_CXX_DEFINITIONS "-DHAS_MPI") >> - list(APPEND DOLFIN_DEP_SYSTEM_INCLUDE_DIRECTORIES ${MPI_INCLUDE_PATH}) >> - list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${MPI_LIBRARIES}) >> - list(APPEND DOLFIN_DEP_INCLUDE_DIRECTORIES ${MPI_INCLUDE_PATH}) >> - set(DOLFIN_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${MPI_COMPILE_FLAGS}") >> + list(APPEND DOLFIN_DEP_SYSTEM_INCLUDE_DIRECTORIES ${MPI_CXX_INCLUDE_PATH}) >> + list(APPEND DOLFIN_TARGET_LINK_LIBRARIES ${MPI_CXX_LIBRARIES}) >> + list(APPEND DOLFIN_DEP_INCLUDE_DIRECTORIES ${MPI_CXX_INCLUDE_PATH}) >> + set(DOLFIN_CXX_FLAGS "${DOLFIN_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}") >> >> # FIXME: Is this linker flag required? >> - #list(APPEND DOLFIN_LINK_FLAGS ${MPI_LINK_FLAGS}) >> + #list(APPEND DOLFIN_LINK_FLAGS ${MPI_CXX_LINK_FLAGS}) >> >> endif() >> >> >> > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : [email protected] > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

