# Configuration for the bzip2 library:
#
-MACRO(FEATURE_BZIP2_FIND_EXTERNAL var)
- FIND_PACKAGE(BZip2)
-
- IF(BZIP2_FOUND)
- #
- # Rename variables:
- #
- SET(BZIP2_VERSION ${BZIP2_VERSION_STRING})
- SET(BZIP2_INCLUDE_DIRS ${BZIP2_INCLUDE_DIR})
-
- SET(${var} TRUE)
- ENDIF()
-ENDMACRO()
-
CONFIGURE_FEATURE(BZIP2)
#
# Configuration for mpi support:
#
-# We look for the C and Fortran libraries as well because they are needed
-# by some external libraries for the link interface:
-#
-
-MACRO(FEATURE_MPI_FIND_EXTERNAL var)
- #
- # Obey a manual user override: If MPI_CXX_FOUND is set to true in the
- # cache, we skip the FIND_PACKAGE calls:
- #
- IF(MPI_CXX_FOUND)
- SET(MPI_FOUND TRUE)
- ENDIF()
-
- #
- # If CMAKE_CXX_COMPILER is already an MPI wrapper, use it to determine
- # the mpi implementation. If MPI_CXX_COMPILER is defined use the value
- # directly.
- #
- SET_IF_EMPTY(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER})
- IF(CMAKE_C_COMPILER_WORKS)
- SET_IF_EMPTY(MPI_C_COMPILER ${CMAKE_C_COMPILER}) # for good measure
- ELSE()
- MESSAGE(STATUS
- "No suitable C compiler was found! MPI C interface can not be "
- "autodetected"
- )
- ENDIF()
- IF(CMAKE_Fortran_COMPILER_WORKS)
- SET_IF_EMPTY(MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER}) # for good measure
- ELSE()
- MESSAGE(STATUS
- "No suitable Fortran compiler was found! MPI Fortran interface can "
- "not be autodetected"
- )
- ENDIF()
-
- FIND_PACKAGE(MPI)
-
- IF(NOT MPI_CXX_FOUND AND DEAL_II_WITH_MPI)
- #
- # CMAKE_CXX_COMPILER is apparently not an mpi wrapper.
- # So, let's be a bit more aggressive in finding MPI (and if
- # DEAL_II_WITH_MPI is set).
- #
- MESSAGE(STATUS
- "MPI not found but DEAL_II_WITH_MPI is set to TRUE."
- " Try again with more aggressive search paths:"
- )
- SET(MPI_FOUND) # clear this value so that FIND_PACKAGE runs again.
- UNSET(MPI_CXX_COMPILER CACHE)
- UNSET(MPI_C_COMPILER CACHE)
- UNSET(MPI_Fortran_COMPILER CACHE)
- FIND_PACKAGE(MPI)
- ENDIF()
-
- #
- # Manually clean up variables:
- #
- FOREACH(_lang C CXX Fortran)
- IF(MPI_${_lang}_LIBRARIES MATCHES "-NOTFOUND")
- SET(MPI_${_lang}_LIBRARIES)
- ENDIF()
- ENDFOREACH()
-
- IF(MPI_CXX_FOUND)
- #
- # Manually assemble some version information:
- #
- FIND_FILE(MPI_MPI_H NAMES mpi.h
- HINTS ${MPI_INCLUDE_PATH}
- )
-
- IF(NOT MPI_MPI_H MATCHES "-NOTFOUND" AND NOT DEFINED MPI_VERSION)
- FILE(STRINGS "${MPI_MPI_H}" MPI_VERSION_MAJOR_STRING
- REGEX "#define.*MPI_VERSION")
- STRING(REGEX REPLACE "^.*MPI_VERSION.*([0-9]+).*" "\\1"
- MPI_VERSION_MAJOR "${MPI_VERSION_MAJOR_STRING}"
- )
- FILE(STRINGS ${MPI_MPI_H} MPI_VERSION_MINOR_STRING
- REGEX "#define.*MPI_SUBVERSION")
- STRING(REGEX REPLACE "^.*MPI_SUBVERSION.*([0-9]+).*" "\\1"
- MPI_VERSION_MINOR "${MPI_VERSION_MINOR_STRING}"
- )
- SET(MPI_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}")
- IF("${MPI_VERSION}" STREQUAL ".")
- SET(MPI_VERSION)
- SET(MPI_VERSION_MAJOR)
- SET(MPI_VERSION_MINOR)
- ENDIF()
-
- # OMPI specific version number:
- FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MAJOR_STRING
- REGEX "#define.*OMPI_MAJOR_VERSION")
- STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION.*([0-9]+).*" "\\1"
- OMPI_VERSION_MAJOR "${OMPI_VERSION_MAJOR_STRING}"
- )
- FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MINOR_STRING
- REGEX "#define.*OMPI_MINOR_VERSION")
- STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION.*([0-9]+).*" "\\1"
- OMPI_VERSION_MINOR "${OMPI_VERSION_MINOR_STRING}"
- )
- FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_RELEASE_STRING
- REGEX "#define.*OMPI_RELEASE_VERSION")
- STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION.*([0-9]+).*" "\\1"
- OMPI_VERSION_SUBMINOR "${OMPI_VERSION_RELEASE_STRING}"
- )
- SET(OMPI_VERSION
- "${OMPI_VERSION_MAJOR}.${OMPI_VERSION_MINOR}.${OMPI_VERSION_SUBMINOR}"
- )
- IF("${OMPI_VERSION}" STREQUAL "..")
- SET(OMPI_VERSION)
- SET(OMPI_VERSION_MAJOR)
- SET(OMPI_VERSION_MINOR)
- SET(OMPI_VERSION_SUBMINOR)
- ENDIF()
- ENDIF()
-
- SET(${var} TRUE)
- ENDIF()
-
- # Hide some variables:
- MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY MPI_MPI_H)
-
- #
- # Populate correct variables:
- #
- SET(MPI_LIBRARIES
- ${MPI_CXX_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES}
- )
- SET(MPI_INCLUDE_DIRS ${MPI_CXX_INCLUDE_PATH})
- SET(MPI_CXX_FLAGS ${MPI_CXX_COMPILE_FLAGS})
- SET(MPI_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}")
-
-ENDMACRO()
-
MACRO(FEATURE_MPI_ERROR_MESSAGE)
MESSAGE(FATAL_ERROR "\n"
)
ENDMACRO()
-
CONFIGURE_FEATURE(MPI)
-
-#
-# The user has to know the location of the mpi headers as well:
-#
-SET(MPI_USER_INCLUDE_DIRS ${MPI_INCLUDE_DIRS})
## ---------------------------------------------------------------------
## $Id$
##
-## Copyright (C) 2012 - 2013 by the deal.II authors
+## Copyright (C) 2012 - 2014 by the deal.II authors
##
## This file is part of the deal.II library.
##
#
CONFIGURE_FEATURE(ZLIB)
-
-# Export ZLIB_VERSION:
-IF(DEFINED ZLIB_VERSION_STRING)
- SET(ZLIB_VERSION ${ZLIB_VERSION_STRING})
-ENDIF()
LIST(APPEND _clear ${_arg})
ENDIF()
ELSE()
- IF(NOT DEFINED ${_arg} OR ${_arg} MATCHES "-NOTFOUND")
+ IF("${_arg}" STREQUAL "" OR ${_arg} MATCHES "-NOTFOUND")
IF(_required AND _fine)
- IF(NOT DEFINED ${_arg})
+ IF("${_arg}" STREQUAL "")
MESSAGE(STATUS
- " ${_feature}_${_variable}: *** Required variable \"${_arg}\" undefined ***"
+ " ${_feature}_${_variable}: *** Required variable \"${_arg}\" empty ***"
)
ELSE()
MESSAGE(STATUS
--- /dev/null
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2014 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# Try to find the BZIP2 library
+#
+# This module exports
+#
+# BZIP2_LIBRARIES
+# BZIP2_INCLUDE_DIRS
+# BZIP2_VERSION
+#
+
+#
+# Houston, we have a problem: CMake ships its own FindBZip2.cmake module.
+# Unfortunately we want to call DEAL_II_PACKAGE_HANDLE. Therefore, use the
+# original find module and do a dummy call to DEAL_II_PACKAGE_HANDLE:
+#
+
+LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+FIND_PACKAGE(BZip2)
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+
+SET(BZIP2_VERSION ${BZIP2_VERSION_STRING})
+SET(_bzip2_libraries ${BZIP2_LIBRARIES})
+
+DEAL_II_PACKAGE_HANDLE(BZIP2
+ LIBRARIES REQUIRED _bzip2_libraries
+ INCLUDE_DIRS REQUIRED BZIP2_INCLUDE_DIR
+ CLEAR
+ BZIP2_INCLUDE_DIR BZIP2_LIBRARY_DEBUG BZIP2_LIBRARY_RELEASE
+ BZIP2_NEED_PREFIX
+ )
--- /dev/null
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2012 - 2014 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# Find MPI
+#
+# This module exports:
+# MPI_LIBRARIES
+# MPI_INCLUDE_DIRS
+# MPI_CXX_FLAGS
+# MPI_LINKER_FLAGS
+# MPI_VERSION
+# OMPI_VERSION
+#
+
+#
+# Configuration for mpi support:
+#
+# We look for the C and Fortran libraries as well because they are needed
+# by some external libraries for the link interface.
+#
+
+IF(MPI_CXX_FOUND)
+ SET(MPI_FOUND TRUE)
+ENDIF()
+
+#
+# If CMAKE_CXX_COMPILER is already an MPI wrapper, use it to determine
+# the mpi implementation. If MPI_CXX_COMPILER is defined use the value
+# directly.
+#
+SET_IF_EMPTY(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER})
+IF(CMAKE_C_COMPILER_WORKS)
+ SET_IF_EMPTY(MPI_C_COMPILER ${CMAKE_C_COMPILER}) # for good measure
+ELSE()
+ MESSAGE(STATUS
+ "No suitable C compiler was found! MPI C interface can not be "
+ "autodetected"
+ )
+ENDIF()
+IF(CMAKE_Fortran_COMPILER_WORKS)
+ SET_IF_EMPTY(MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER}) # for good measure
+ELSE()
+ MESSAGE(STATUS
+ "No suitable Fortran compiler was found! MPI Fortran interface can "
+ "not be autodetected"
+ )
+ENDIF()
+
+#
+# Call the system FindMPI.cmake module:
+#
+LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+FIND_PACKAGE(MPI)
+
+IF(NOT MPI_CXX_FOUND AND DEAL_II_WITH_MPI)
+ #
+ # CMAKE_CXX_COMPILER is apparently not an mpi wrapper.
+ # So, let's be a bit more aggressive in finding MPI (and if
+ # DEAL_II_WITH_MPI is set).
+ #
+ MESSAGE(STATUS
+ "MPI not found but DEAL_II_WITH_MPI is set to TRUE."
+ " Try again with more aggressive search paths:"
+ )
+ # Clear variables so that FIND_PACKAGE runs again:
+ SET(MPI_FOUND)
+ UNSET(MPI_CXX_COMPILER CACHE)
+ UNSET(MPI_C_COMPILER CACHE)
+ UNSET(MPI_Fortran_COMPILER CACHE)
+ FIND_PACKAGE(MPI)
+ENDIF()
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+
+
+#
+# Manually assemble some version information:
+#
+
+DEAL_II_FIND_FILE(MPI_MPI_H
+ NAMES mpi.h
+ HINTS ${MPI_CXX_INCLUDE_PATH} ${MPI_C_INCLUDE_PATH}
+ )
+IF(NOT MPI_MPI_H MATCHES "-NOTFOUND" AND NOT DEFINED MPI_VERSION)
+ FILE(STRINGS "${MPI_MPI_H}" MPI_VERSION_MAJOR_STRING
+ REGEX "#define.*MPI_VERSION")
+ STRING(REGEX REPLACE "^.*MPI_VERSION.*([0-9]+).*" "\\1"
+ MPI_VERSION_MAJOR "${MPI_VERSION_MAJOR_STRING}"
+ )
+ FILE(STRINGS ${MPI_MPI_H} MPI_VERSION_MINOR_STRING
+ REGEX "#define.*MPI_SUBVERSION")
+ STRING(REGEX REPLACE "^.*MPI_SUBVERSION.*([0-9]+).*" "\\1"
+ MPI_VERSION_MINOR "${MPI_VERSION_MINOR_STRING}"
+ )
+ SET(MPI_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}")
+ IF("${MPI_VERSION}" STREQUAL ".")
+ SET(MPI_VERSION)
+ SET(MPI_VERSION_MAJOR)
+ SET(MPI_VERSION_MINOR)
+ ENDIF()
+
+ # OMPI specific version number:
+ FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MAJOR_STRING
+ REGEX "#define.*OMPI_MAJOR_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_MAJOR "${OMPI_VERSION_MAJOR_STRING}"
+ )
+ FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MINOR_STRING
+ REGEX "#define.*OMPI_MINOR_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_MINOR "${OMPI_VERSION_MINOR_STRING}"
+ )
+ FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_RELEASE_STRING
+ REGEX "#define.*OMPI_RELEASE_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_SUBMINOR "${OMPI_VERSION_RELEASE_STRING}"
+ )
+ SET(OMPI_VERSION
+ "${OMPI_VERSION_MAJOR}.${OMPI_VERSION_MINOR}.${OMPI_VERSION_SUBMINOR}"
+ )
+ IF("${OMPI_VERSION}" STREQUAL "..")
+ SET(OMPI_VERSION)
+ SET(OMPI_VERSION_MAJOR)
+ SET(OMPI_VERSION_MINOR)
+ SET(OMPI_VERSION_SUBMINOR)
+ ENDIF()
+ENDIF()
+
+DEAL_II_PACKAGE_HANDLE(MPI
+ LIBRARIES
+ REQUIRED MPI_CXX_LIBRARIES
+ OPTIONAL MPI_Fortran_LIBRARIES MPI_C_LIBRARIES
+ INCLUDE_DIRS
+ REQUIRED MPI_CXX_INCLUDE_PATH
+ OPTIONAL MPI_C_INCLUDE_PATH
+ USER_INCLUDE_DIRS
+ REQUIRED MPI_CXX_INCLUDE_PATH
+ OPTIONAL MPI_C_INCLUDE_PATH
+ CXX_FLAGS OPTIONAL MPI_CXX_COMPILE_FLAGS
+ LINKER_FLAGS OPTIONAL MPI_CXX_LINK_FLAGS
+ CLEAR
+ MPI_MPI_H
+ MPI_HEADER_PATH
+ MPI_LIB
+ MPIEXEC
+ MPI_CXX_COMPILER
+ MPI_C_COMPILER
+ MPI_Fortran_COMPILER
+ )
+
--- /dev/null
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2014 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# Try to find the ZLIB library
+#
+# This module exports
+#
+# ZLIB_LIBRARIES
+# ZLIB_INCLUDE_DIRS
+# ZLIB_VERSION
+#
+
+SET(ZLIB_DIR "" CACHE PATH "An optional hint to a ZLIB installation")
+SET_IF_EMPTY(ZLIB_DIR "$ENV{ZLIB_DIR}")
+
+#
+# Houston, we have a problem: CMake ships its own FindZLIB.cmake module.
+# Unfortunately we want to call DEAL_II_PACKAGE_HANDLE. Therefore, use the
+# original find module and do a dummy call to DEAL_II_PACKAGE_HANDLE:
+#
+
+IF(NOT "${ZLIB_DIR}" STREQUAL "")
+ SET(ZLIB_ROOT ${ZLIB_DIR})
+ENDIF()
+LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+FIND_PACKAGE(ZLIB)
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
+
+SET(ZLIB_VERSION ${ZLIB_VERSION_STRING})
+SET(_zlib_libraries ${ZLIB_LIBRARIES})
+SET(_zlib_include_dirs ${ZLIB_INCLUDE_DIRS})
+
+DEAL_II_PACKAGE_HANDLE(ZLIB
+ LIBRARIES REQUIRED _zlib_libraries
+ INCLUDE_DIRS REQUIRED _zlib_include_dirs
+ CLEAR ZLIB_INCLUDE_DIR ZLIB_LIBRARY
+ )