From: maier Date: Sat, 26 Apr 2014 17:30:00 +0000 (+0000) Subject: CMake: Provide our own PACKAGE_HANDLE_STANDARD_ARGS X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e3e0d2870e61432d020407b6e28a2f0955ac807;p=dealii-svn.git CMake: Provide our own PACKAGE_HANDLE_STANDARD_ARGS git-svn-id: https://svn.dealii.org/trunk@32845 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake b/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake new file mode 100644 index 0000000000..460f5b5d35 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake @@ -0,0 +1,126 @@ +## --------------------------------------------------------------------- +## $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. +## +## --------------------------------------------------------------------- + +# +# DEAL_II_PACKAGE_HANDLE +# +# TODO: Documentation +# + +MACRO(DEAL_II_PACKAGE_HANDLE _feature _var) + + IF(DEFINED ${_feature}_VERSION) + MESSAGE(STATUS " ${_feature}_VERSION: ${${_feature}_VERSION}") + ENDIF() + + SET(${_feature}_FOUND TRUE) + + SET(_variable ${_var}) + SET(_cleanup ${_var}) + SET(${_feature}_${_variable} "") + SET(_required TRUE) + SET(_fine TRUE) + + FOREACH(_arg ${ARGN}) + IF(_arg MATCHES "^LIBRARIES(|_DEBUG|_RELEASE)$" + OR _arg MATCHES "^(|BUNDLED_|USER_)INCLUDE_DIRS$" + OR _arg MATCHES "^(|USER_)DEFINITIONS(|_DEBUG|_RELEASE)$" + OR _arg MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)" + OR _arg MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)") + + IF(_fine) + IF(_variable MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)" + OR _variable MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)") + TO_STRING(${_feature}_${_variable} ${${_feature}_${_variable}}) + ENDIF() + MESSAGE(STATUS " ${_feature}_${_variable}: ${${_feature}_${_variable}}") + ENDIF() + + # + # *Yay* a new keyword. + # + SET(_variable ${_arg}) + LIST(APPEND _cleanup ${_var}) + SET(${_feature}_${_variable} "") + SET(_required TRUE) + SET(_fine TRUE) + + ELSEIF("${_arg}" STREQUAL "REQUIRED") + SET(_required TRUE) + ELSEIF("${_arg}" STREQUAL "OPTIONAL") + SET(_required FALSE) + ELSEIF( _arg MATCHES "^(optimized|debug|general)$" + AND "${_variable}" STREQUAL "LIBRARIES") + # + # Keywords are special... + # + LIST(APPEND ${_feature}_${_variable} ${_arg}) + ELSE() + MARK_AS_ADVANCED(${_arg}) + IF(NOT DEFINED ${_arg} OR ${_arg} MATCHES "-NOTFOUND") + IF(_required AND _fine) + IF(NOT DEFINED ${_arg}) + MESSAGE(STATUS + " ${_feature}_${_variable}: *** Required variable \"${_arg}\" undefined ***" + ) + ELSE() + MESSAGE(STATUS + " ${_feature}_${_variable}: *** Required variable \"${_arg}\" set to NOTFOUND ***" + ) + ENDIF() + SET(${_feature}_FOUND FALSE) + SET(_fine FALSE) + ENDIF() + ELSE() + LIST(APPEND ${_feature}_${_variable} ${${_arg}}) + ENDIF() + ENDIF() + ENDFOREACH() + + IF(_fine) + IF(_variable MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)" + OR _variable MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)") + TO_STRING(${_feature}_${_variable} ${${_feature}_${_variable}}) + ENDIF() + MESSAGE(STATUS " ${_feature}_${_variable}: ${${_feature}_${_variable}}") + ENDIF() + + IF(${_feature}_FOUND) + # + # Deduplicate entries in *_INCLUDE_DIRS and *_LIBRARIES + # + FOREACH(_suffix INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS) + REMOVE_DUPLICATES(${_feature}_${_suffix}) + ENDFOREACH() + FOREACH(_suffix + LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG + USER_DEFINITIONS USER_DEFINITIONS_DEBUG USER_DEFINITIONS_RELEASE + DEFINITIONS DEFINITIONS_DEBUG DEFINITIONS_RELEASE + ) + REMOVE_DUPLICATES(${_feature}_${_suffix} REVERSE) + ENDFOREACH() + + MESSAGE(STATUS "Found ${_feature}") + MARK_AS_ADVANCED(${_feature}_DIR) + + ELSE() + + FOREACH(_v _cleanup) + SET(${_feature}_${_v}) + ENDFOREACH() + MESSAGE(STATUS "Could NOT find ${_feature}") + ENDIF() +ENDMACRO() diff --git a/deal.II/cmake/modules/FindARPACK.cmake b/deal.II/cmake/modules/FindARPACK.cmake index cd2c9bcef0..c739c0ece8 100644 --- a/deal.II/cmake/modules/FindARPACK.cmake +++ b/deal.II/cmake/modules/FindARPACK.cmake @@ -27,34 +27,16 @@ # TODO: ARPACK and mpi... # -INCLUDE(FindPackageHandleStandardArgs) - SET(ARPACK_DIR "" CACHE PATH "An optional hint to an ARPACK installation") SET_IF_EMPTY(ARPACK_DIR "$ENV{ARPACK_DIR}") FIND_LIBRARY(ARPACK_LIBRARY NAMES arpack - HINTS - ${ARPACK_DIR} + HINTS ${ARPACK_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ARPACK DEFAULT_MSG - ARPACK_LIBRARY - LAPACK_FOUND - ) - -MARK_AS_ADVANCED( - lapack_LIBRARY - atlas_LIBRARY - blas_LIBRARY - ARPACK_LIBRARY +DEAL_II_PACKAGE_HANDLE(ARPACK + LIBRARIES REQUIRED ARPACK_LIBRARY LAPACK_LIBRARIES + LINKER_FLAGS OPTIONAL LAPACK_LINKER_FLAGS ) - -IF(ARPACK_FOUND) - SET(ARPACK_LIBRARIES ${ARPACK_LIBRARY} ${LAPACK_LIBRARIES}) - SET(ARPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) - - MARK_AS_ADVANCED(ARPACK_DIR) -ENDIF() - diff --git a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake index 8b2dff588e..1dc401e635 100644 --- a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake +++ b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake @@ -104,7 +104,7 @@ IF(LAPACK_FOUND) ENDIF() LIST(REMOVE_ITEM LAPACK_LIBRARIES "FALSE") - MARK_AS_ADVANCED( BLAS_DIR LAPACK_DIR) + MARK_AS_ADVANCED(BLAS_DIR LAPACK_DIR) ELSE() SET(DEALII_LAPACK_FOUND FALSE) diff --git a/deal.II/cmake/modules/FindHDF5.cmake b/deal.II/cmake/modules/FindHDF5.cmake index 73cb833302..258621b53e 100644 --- a/deal.II/cmake/modules/FindHDF5.cmake +++ b/deal.II/cmake/modules/FindHDF5.cmake @@ -24,60 +24,31 @@ # HDF5_WITH_MPI # -INCLUDE(FindPackageHandleStandardArgs) - SET(HDF5_DIR "" CACHE PATH "An optional hint to an hdf5 directory") SET_IF_EMPTY(HDF5_DIR "$ENV{HDF5_DIR}") FIND_PATH(HDF5_INCLUDE_DIR hdf5.h - HINTS - ${HDF5_DIR} - PATH_SUFFIXES - hdf5 hdf5/include include/hdf5 include + HINTS ${HDF5_DIR} + PATH_SUFFIXES hdf5 hdf5/include include/hdf5 include ) FIND_LIBRARY(HDF5_LIBRARY NAMES hdf5 - HINTS - ${HDF5_DIR} - PATH_SUFFIXES - hdf5/lib lib${LIB_SUFFIX} lib64 lib + HINTS ${HDF5_DIR} + PATH_SUFFIXES hdf5/lib lib${LIB_SUFFIX} lib64 lib ) FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl - HINTS - ${HDF5_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib + HINTS ${HDF5_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) FIND_FILE(HDF5_PUBCONF NAMES H5pubconf.h H5pubconf-64.h - HINTS - ${HDF5_INCLUDE_DIR} - ${HDF5_DIR} - PATH_SUFFIXES - hdf5 hdf5/include include/hdf5 include - ) - -SET(_output ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG - _output # Cosmetic: Gives nice output - HDF5_HL_LIBRARY - HDF5_LIBRARY - HDF5_INCLUDE_DIR - HDF5_PUBCONF - ) - -MARK_AS_ADVANCED( - HDF5_LIBRARY - HDF5_HL_LIBRARY - HDF5_INCLUDE_DIR - HDF5_PUBCONF + HINTS ${HDF5_INCLUDE_DIR} ${HDF5_DIR} + PATH_SUFFIXES hdf5 hdf5/include include/hdf5 include ) +MARK_AS_ADVANCED(HDF5_PUBCONF) -IF(HDF5_FOUND) - SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) - SET(HDF5_LIBRARIES ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY} ${MPI_C_LIBRARIES}) - +IF(EXISTS ${HDF5_PUBCONF}) # # Is hdf5 compiled with support for mpi? # @@ -89,7 +60,12 @@ IF(HDF5_FOUND) ELSE() SET(HDF5_WITH_MPI TRUE) ENDIF() - - MARK_AS_ADVANCED(HDF5_DIR) ENDIF() +DEAL_II_PACKAGE_HANDLE(HDF5 + LIBRARIES + REQUIRED HDF5_HL_LIBRARY HDF5_LIBRARY + OPTIONAL MPI_C_LIBRARIES + INCLUDE_DIRS + REQUIRED HDF5_INCLUDE_DIR + ) diff --git a/deal.II/cmake/modules/FindMETIS.cmake b/deal.II/cmake/modules/FindMETIS.cmake index 0accb210fa..01483cf689 100644 --- a/deal.II/cmake/modules/FindMETIS.cmake +++ b/deal.II/cmake/modules/FindMETIS.cmake @@ -27,8 +27,6 @@ # METIS_VERSION_SUBMINOR # -INCLUDE(FindPackageHandleStandardArgs) - SET(METIS_DIR "" CACHE PATH "An optional hint to a metis directory") SET_IF_EMPTY(METIS_DIR "$ENV{METIS_DIR}") @@ -41,8 +39,7 @@ SET_IF_EMPTY(METIS_DIR "$ENV{METIS_DIR}") FIND_LIBRARY(METIS_LIBRARY NAMES metis - HINTS - ${METIS_DIR} + HINTS ${METIS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib # This is a hint, isn't it? @@ -66,10 +63,8 @@ FIND_LIBRARY(PARMETIS_LIBRARY ) FIND_PATH(METIS_INCLUDE_DIR metis.h - HINTS - ${METIS_DIR} - PATH_SUFFIXES - metis include/metis include + HINTS ${METIS_DIR} + PATH_SUFFIXES metis include/metis include ) IF(EXISTS ${METIS_INCLUDE_DIR}/metis.h) @@ -99,29 +94,11 @@ IF(EXISTS ${METIS_INCLUDE_DIR}/metis.h) ) ENDIF() - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG - METIS_LIBRARY - METIS_INCLUDE_DIR +DEAL_II_PACKAGE_HANDLE(METIS + LIBRARIES + OPTIONAL PARMETIS_LIBRARY + REQUIRED METIS_LIBRARY + OPTIONAL MPI_C_LIBRARIES + INCLUDE_DIRS + REQUIRED METIS_INCLUDE_DIR ) - -MARK_AS_ADVANCED( - METIS_LIBRARY - PARMETIS_LIBRARY - METIS_INCLUDE_DIR - ) - -IF(METIS_FOUND) - - IF(NOT PARMETIS_LIBRARY MATCHES "-NOTFOUND") - SET(METIS_LIBRARIES ${PARMETIS_LIBRARY}) - ENDIF() - - LIST(APPEND METIS_LIBRARIES - ${METIS_LIBRARY} - ${MPI_C_LIBRARIES} # for good measure - ) - SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR}) - - MARK_AS_ADVANCED(METIS_DIR) -ENDIF() diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake index db55daab2f..b6d56d2ca1 100644 --- a/deal.II/cmake/modules/FindMUMPS.cmake +++ b/deal.II/cmake/modules/FindMUMPS.cmake @@ -31,8 +31,6 @@ SET(MUMPS_DIR "" CACHE PATH "An optional hint to a mumps directory") SET_IF_EMPTY(MUMPS_DIR "$ENV{MUMPS_DIR}") -INCLUDE(FindPackageHandleStandardArgs) - # # Search for all known dependencies of MUMPS: # (We'll rely on the user of FindMUMPS, setting up mpi *cough*) @@ -41,23 +39,19 @@ FIND_PACKAGE(SCALAPACK) # which will also include lapack and blas FIND_PATH(MUMPS_INCLUDE_DIR dmumps_c.h - HINTS - ${MUMPS_DIR} - PATH_SUFFIXES - mumps include/mumps include + HINTS ${MUMPS_DIR} + PATH_SUFFIXES mumps include/mumps include ) FIND_LIBRARY(DMUMPS_LIBRARY NAMES dmumps - HINTS - ${MUMPS_DIR} + HINTS ${MUMPS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) FIND_LIBRARY(MUMPS_COMMON_LIBRARY NAMES mumps_common - HINTS - ${MUMPS_DIR} + HINTS ${MUMPS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) @@ -66,8 +60,7 @@ FIND_LIBRARY(MUMPS_COMMON_LIBRARY # FIND_LIBRARY(PORD_LIBRARY NAMES pord - HINTS - ${MUMPS_DIR} + HINTS ${MUMPS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) MARK_AS_ADVANCED(PORD_LIBRARY) @@ -93,34 +86,14 @@ IF(EXISTS ${MUMPS_INCLUDE_DIR}/dmumps_c.h) ) ENDIF() -SET(_output ${DMUMPS_LIBRARY} ${MUMPS_COMMON_LIBRARY} ${PORD_LIBRARY}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUMPS DEFAULT_MSG - _output # Cosmetic: Gives nice output - DMUMPS_LIBRARY - MUMPS_COMMON_LIBRARY - MUMPS_INCLUDE_DIR - SCALAPACK_FOUND - ) - -MARK_AS_ADVANCED( - DMUMPS_LIBRARY - MUMPS_COMMON_LIBRARY - MUMPS_INCLUDE_DIR - PORD_LIBRARY +DEAL_II_PACKAGE_HANDLE(MUMPS + LIBRARIES + REQUIRED DMUMPS_LIBRARY MUMPS_COMMON_LIBRARY + OPTIONAL PORD_LIBRARY + REQUIRED SCALAPACK_LIBRARIES + OPTIONAL METIS_LIBRARIES MPI_Fortran_LIBRARIES + INCLUDE_DIRS + REQUIRED MUMPS_INCLUDE_DIR + LINKER_FLAGS + OPTIONAL SCALAPACK_LINKER_FLAGS ) - -IF(MUMPS_FOUND) - SET(MUMPS_INCLUDE_DIRS ${MUMPS_INCLUDE_DIR}) - SET(MUMPS_LIBRARIES - ${DMUMPS_LIBRARY} - ${MUMPS_COMMON_LIBRARY} - ${PORD_LIBRARY} - ${SCALAPACK_LIBRARIES} - ${METIS_LIBRARIES} - ${MPI_Fortran_LIBRARIES} - ) - SET(MUMPS_LINKER_FLAGS ${SCALAPACK_LINKER_FLAGS}) - - MARK_AS_ADVANCED(MUMPS_DIR) -ENDIF() - diff --git a/deal.II/cmake/modules/FindMUPARSER.cmake b/deal.II/cmake/modules/FindMUPARSER.cmake index 060ec2fe7a..d6e42eaf4d 100644 --- a/deal.II/cmake/modules/FindMUPARSER.cmake +++ b/deal.II/cmake/modules/FindMUPARSER.cmake @@ -27,8 +27,6 @@ # MUPARSER_VERSION_SUBMINOR # -INCLUDE(FindPackageHandleStandardArgs) - SET(MUPARSER_DIR "" CACHE PATH "An optional hint to a MUPARSER installation") SET_IF_EMPTY(MUPARSER_DIR "$ENV{MUPARSER_DIR}") @@ -61,14 +59,7 @@ IF(EXISTS ${MUPARSER_INCLUDE_DIR}/muParserDef.h) ) ENDIF() -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUPARSER DEFAULT_MSG - MUPARSER_LIBRARY - MUPARSER_INCLUDE_DIR +DEAL_II_PACKAGE_HANDLE(MUPARSER + LIBRARIES REQUIRED MUPARSER_LIBRARY + INCLUDE_DIRS REQUIRED MUPARSER_INCLUDE_DIR ) - -IF(MUPARSER_FOUND) - SET(MUPARSER_LIBRARIES ${MUPARSER_LIBRARY}) - SET(MUPARSER_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIR}) - - MARK_AS_ADVANCED(MUPARSER_DIR) -ENDIF() diff --git a/deal.II/cmake/modules/FindNETCDF.cmake b/deal.II/cmake/modules/FindNETCDF.cmake index 5ee129ec46..9b99e8b163 100644 --- a/deal.II/cmake/modules/FindNETCDF.cmake +++ b/deal.II/cmake/modules/FindNETCDF.cmake @@ -23,16 +23,12 @@ # NETCDF_INCLUDE_DIRS # -INCLUDE(FindPackageHandleStandardArgs) - SET(NETCDF_DIR "" CACHE PATH "An optional hint to a NETCDF installation") SET_IF_EMPTY(NETCDF_DIR "$ENV{NETCDF_DIR}") FIND_PATH(NETCDF_INCLUDE_DIR netcdfcpp.h - HINTS - ${NETCDF_DIR} - PATH_SUFFIXES - netcdf include + HINTS ${NETCDF_DIR} + PATH_SUFFIXES netcdf include ) # @@ -43,36 +39,16 @@ FIND_PATH(NETCDF_INCLUDE_DIR netcdfcpp.h # FIND_LIBRARY(NETCDF_CPLUSPLUS_LIBRARY NAMES netcdf_c++ netcdf_cpp - HINTS - ${NETCDF_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib + HINTS ${NETCDF_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) FIND_LIBRARY(NETCDF_C_LIBRARY NAMES netcdf - HINTS - ${NETCDF_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - ) - -SET(_output ${NETCDF_CPLUSPLUS_LIBRARY} ${NETCDF_C_LIBRARY}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETCDF DEFAULT_MSG - _output # Cosmetic: Gives nice output - NETCDF_CPLUSPLUS_LIBRARY - NETCDF_C_LIBRARY - NETCDF_INCLUDE_DIR + HINTS ${NETCDF_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) -MARK_AS_ADVANCED( - NETCDF_CPLUSPLUS_LIBRARY - NETCDF_C_LIBRARY - NETCDF_INCLUDE_DIR +DEAL_II_PACKAGE_HANDLE(NETCDF + LIBRARIES REQUIRED NETCDF_CPLUSPLUS_LIBRARY NETCDF_C_LIBRARY + INCLUDE_DIRS REQUIRED NETCDF_INCLUDE_DIR ) - -IF(NETCDF_FOUND) - SET(NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) - SET(NETCDF_LIBRARIES ${NETCDF_CPLUSPLUS_LIBRARY} ${NETCDF_C_LIBRARY}) - - MARK_AS_ADVANCED(NETCDF_DIR) -ENDIF() diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index 4104e6952d..204fdd0935 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -55,20 +55,8 @@ FIND_PATH(SC_INCLUDE_DIR sc.h FIND_LIBRARY(P4EST_LIBRARY_OPTIMIZED NAMES p4est - HINTS - ${P4EST_DIR}/FAST - ${P4EST_DIR}/DEBUG - ${P4EST_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib src - ) - -FIND_LIBRARY(P4EST_LIBRARY_DEBUG - NAMES p4est - HINTS - ${P4EST_DIR}/DEBUG - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib src + HINTS ${P4EST_DIR}/FAST ${P4EST_DIR}/DEBUG ${P4EST_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src ) FIND_LIBRARY(SC_LIBRARY_OPTIMIZED @@ -84,22 +72,40 @@ FIND_LIBRARY(SC_LIBRARY_OPTIMIZED lib${LIB_SUFFIX} lib64 lib src sc/src ) +# +# Support debug variants as well: +# + +FIND_LIBRARY(P4EST_LIBRARY_DEBUG + NAMES p4est + HINTS ${P4EST_DIR}/DEBUG + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src + ) + FIND_LIBRARY(SC_LIBRARY_DEBUG NAMES sc - HINTS - ${SC_DIR}/DEBUG - ${P4EST_DIR}/DEBUG - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib src sc/src + HINTS ${SC_DIR}/DEBUG ${P4EST_DIR}/DEBUG + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src sc/src ) +MARK_AS_ADVANCED(P4EST_LIBRARY_DEBUG SC_LIBRARY_DEBUG) + +IF( ( "${P4EST_LIBRARY_OPTIMIZED}" STREQUAL "${P4EST_LIBRARY_DEBUG}" + AND "${SC_LIBRARY_OPTIMIZED}" STREQUAL "${SC_LIBRARY_DEBUG}" ) + OR P4EST_LIBRARY_DEBUG MATCHES "-NOTFOUND" + OR SC_LIBRARY_DEBUG MATCHES "-NOTFOUND" ) + SET(_libraries P4EST_LIBRARY_OPTIMIZED SC_LIBRARY_OPTIMIZED) +ELSE() + SET(_libraries + optimized P4EST_LIBRARY_OPTIMIZED SC_LIBRARY_OPTIMIZED + debug P4EST_LIBRARY_DEBUG SC_LIBRARY_DEBUG + general + ) +ENDIF() + FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h - HINTS - ${P4EST_DIR}/FAST - ${P4EST_DIR}/DEBUG - ${P4EST_DIR} - PATH_SUFFIXES - p4est include/p4est include src + HINTS ${P4EST_DIR}/FAST ${P4EST_DIR}/DEBUG ${P4EST_DIR} + PATH_SUFFIXES p4est include/p4est include src ) IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h) @@ -144,57 +150,10 @@ IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h) ENDIF() ENDIF() - -SET(_output ${P4EST_LIBRARY_OPTMIZED} ${SC_LIBRARY_OPTIMIZED}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG - _output # Cosmetic: Gives nice output - P4EST_LIBRARY_OPTIMIZED - SC_LIBRARY_OPTIMIZED - P4EST_INCLUDE_DIR - SC_INCLUDE_DIR - ) - -MARK_AS_ADVANCED( - P4EST_LIBRARY_OPTIMIZED - P4EST_LIBRARY_DEBUG - P4EST_INCLUDE_DIR - SC_LIBRARY_OPTIMIZED - SC_LIBRARY_DEBUG - SC_INCLUDE_DIR +DEAL_II_PACKAGE_HANDLE(P4EST + LIBRARIES + REQUIRED ${_libraries} + OPTIONAL LAPACK_LIBRARIES MPI_C_LIBRARIES + INCLUDE_DIRS + REQUIRED P4EST_INCLUDE_DIR SC_INCLUDE_DIR ) - - -IF(P4EST_FOUND) - - IF( ( "${P4EST_LIBRARY_OPTIMIZED}" STREQUAL "${P4EST_LIBRARY_DEBUG}" - AND - "${SC_LIBRARY_OPTIMIZED}" STREQUAL "${SC_LIBRARY_DEBUG}" ) - OR P4EST_LIBRARY_DEBUG MATCHES "-NOTFOUND" - OR SC_LIBRARY_DEBUG MATCHES "-NOTFOUND" ) - SET(P4EST_LIBRARIES - ${P4EST_LIBRARY_OPTIMIZED} - ${SC_LIBRARY_OPTIMIZED} - ) - ELSE() - SET(P4EST_LIBRARIES - optimized - ${P4EST_LIBRARY_OPTIMIZED} - ${SC_LIBRARY_OPTIMIZED} - debug - ${P4EST_LIBRARY_DEBUG} - ${SC_LIBRARY_DEBUG} - general - ) - ENDIF() - - LIST(APPEND P4EST_LIBRARIES - ${LAPACK_LIBRARIES} # for good measure - ${MPI_C_LIBRARIES} # for good measure - ) - SET(P4EST_INCLUDE_DIRS - ${P4EST_INCLUDE_DIR} - ${SC_INCLUDE_DIR} - ) - - MARK_AS_ADVANCED(P4EST_DIR) -ENDIF() diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index be222bcaf1..9011d48c17 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -32,20 +32,14 @@ # PETSC_WITH_COMPLEX # -INCLUDE(FindPackageHandleStandardArgs) - SET(PETSC_DIR "" CACHE PATH "An optional hint to a PETSc directory") SET(PETSC_ARCH "" CACHE STRING "An optional hint to a PETSc arch") SET_IF_EMPTY(PETSC_DIR "$ENV{PETSC_DIR}") SET_IF_EMPTY(PETSC_ARCH "$ENV{PETSC_ARCH}") - FIND_LIBRARY(PETSC_LIBRARY NAMES petsc - HINTS - # petsc is special. Account for that - ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH} + HINTS ${PETSC_DIR} ${PETSC_DIR}/${PETSC_ARCH} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) @@ -54,11 +48,7 @@ FIND_LIBRARY(PETSC_LIBRARY # FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h - HINTS - # petsc is special. Account for that - ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH} - ${PETSC_INCLUDE_DIRS} + HINTS ${PETSC_DIR} ${PETSC_DIR}/${PETSC_ARCH} ${PETSC_INCLUDE_DIRS} PATH_SUFFIXES petsc include include/petsc ) @@ -113,10 +103,7 @@ ENDIF() # FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h - HINTS - ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH} - ${PETSC_INCLUDE_DIRS} + HINTS ${PETSC_DIR} ${PETSC_DIR}/${PETSC_ARCH} ${PETSC_INCLUDE_DIRS} PATH_SUFFIXES petsc include include/petsc ) @@ -155,9 +142,7 @@ ENDIF() FIND_FILE(PETSC_PETSCVARIABLES NAMES petscvariables - HINTS - ${PETSC_DIR}/${PETSC_ARCH} - ${PETSC_DIR} + HINTS ${PETSC_DIR}/${PETSC_ARCH} ${PETSC_DIR} PATH_SUFFIXES conf ) @@ -228,31 +213,17 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") ENDIF() ENDFOREACH() - ENDIF() -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG - PETSC_LIBRARY - PETSC_INCLUDE_DIR_ARCH - PETSC_INCLUDE_DIR_COMMON - ) - -MARK_AS_ADVANCED( - PETSC_INCLUDE_DIR_ARCH - PETSC_INCLUDE_DIR_COMMON - PETSC_INCLUDE_DIRS - PETSC_LIBRARY - PETSC_PETSCVARIABLES +DEAL_II_PACKAGE_HANDLE(PETSC + LIBRARIES + REQUIRED PETSC_LIBRARY + OPTIONAL _petsc_libraries + INCLUDE_DIRS + REQUIRED PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH + OPTIONAL _petsc_includes ) IF(PETSC_FOUND) - SET(PETSC_LIBRARIES ${PETSC_LIBRARY} ${_petsc_libraries}) - SET(PETSC_INCLUDE_DIRS - ${PETSC_INCLUDE_DIR_COMMON} - ${PETSC_INCLUDE_DIR_ARCH} - ${_petsc_includes} - ) - - MARK_AS_ADVANCED(PETSC_ARCH PETSC_DIR) + MARK_AS_ADVANCED(PETSC_ARCH) ENDIF() - diff --git a/deal.II/cmake/modules/FindSCALAPACK.cmake b/deal.II/cmake/modules/FindSCALAPACK.cmake index 57fad7cecb..d8a295070d 100644 --- a/deal.II/cmake/modules/FindSCALAPACK.cmake +++ b/deal.II/cmake/modules/FindSCALAPACK.cmake @@ -30,13 +30,9 @@ SET(BLACS_DIR "" CACHE PATH "An optional hint to a BLACS directory") SET_IF_EMPTY(SCALAPACK_DIR "$ENV{SCALAPACK_DIR}") SET_IF_EMPTY(BLACS_DIR "$ENV{BLACS_DIR}") -INCLUDE(FindPackageHandleStandardArgs) - FIND_LIBRARY(SCALAPACK_LIBRARY NAMES scalapack - HINTS - ${SCALAPACK_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib + HINTS ${SCALAPACK_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) # @@ -48,43 +44,20 @@ FOREACH(_lib blacs blacsCinit blacsF77init) STRING(TOUPPER "${_lib}" _lib_upper) FIND_LIBRARY(${_lib_upper}_LIBRARY NAMES ${_lib} ${_lib}_MPI-LINUX-0 ${_lib}_MPI-DARWIN-0 - HINTS - ${BLACS_DIR} - ${SCALAPACK_DIR} - ${SCALAPACK_DIR}/../blacs/ + HINTS ${BLACS_DIR} ${SCALAPACK_DIR} ${SCALAPACK_DIR}/../blacs/ PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib LIB ) - IF(NOT ${_lib_upper}_LIBRARY MATCHES "-NOTFOUND") - LIST(APPEND BLACS_LIBRARIES - ${${_lib_upper}_LIBRARY} - ) - ENDIF() + MARK_AS_ADVANCED(${_lib_upper}_LIBRARY) ENDFOREACH() - -SET(_output ${SCALAPACK_LIBRARY} ${BLACS_LIBRARIES}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SCALAPACK DEFAULT_MSG - _output # Cosmetic: Gives nice output - SCALAPACK_LIBRARY - LAPACK_FOUND - ) - -MARK_AS_ADVANCED( - SCALAPACK_LIBRARY - BLACS_LIBRARY - BLACSCINIT_LIBRARY - BLACSF77INIT_LIBRARY +DEAL_II_PACKAGE_HANDLE(SCALAPACK + LIBRARIES + REQUIRED SCALAPACK_LIBRARY LAPACK_LIBRARIES + OPTIONAL BLACS_LIBRARY BLACSCINIT_LIBRARY BLACSF77INIT_LIBRARY MPI_Fortran_LIBRARIES + LINKER_FLAGS + OPTIONAL LAPACK_LINKER_FLAGS ) IF(SCALAPACK_FOUND) - SET(SCALAPACK_LIBRARIES - ${SCALAPACK_LIBRARY} - ${LAPACK_LIBRARIES} - ${BLACS_LIBRARIES} - ${MPI_Fortran_LIBRARIES} # for good measure - ) - SET(SCALAPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) - - MARK_AS_ADVANCED(SCALAPACK_DIR BLACS_DIR) + MARK_AS_ADVANCED(BLACS_DIR) ENDIF() - diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake index 51c6128318..28892f9b9a 100644 --- a/deal.II/cmake/modules/FindSLEPC.cmake +++ b/deal.II/cmake/modules/FindSLEPC.cmake @@ -29,8 +29,6 @@ # SLEPC_VERSION_PATCH # -INCLUDE(FindPackageHandleStandardArgs) - SET(SLEPC_DIR "" CACHE PATH "An optional hint to a SLEPC directory") SET_IF_EMPTY(SLEPC_DIR "$ENV{SLEPC_DIR}") SET_IF_EMPTY(PETSC_DIR "$ENV{PETSC_DIR}") @@ -43,17 +41,12 @@ SET_IF_EMPTY(PETSC_ARCH "$ENV{PETSC_ARCH}") FIND_LIBRARY(SLEPC_LIBRARY NAMES slepc - HINTS - # SLEPC is special. Account for that - ${SLEPC_DIR} - ${SLEPC_DIR}/${PETSC_ARCH} - ${PETSC_DIR} + HINTS ${SLEPC_DIR} ${SLEPC_DIR}/${PETSC_ARCH} ${PETSC_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) FIND_PATH(SLEPC_INCLUDE_DIR_ARCH slepcconf.h HINTS - # SLEPC is special. Account for that ${SLEPC_DIR} ${SLEPC_DIR}/${PETSC_ARCH} ${SLEPC_INCLUDE_DIRS} @@ -82,13 +75,11 @@ IF(EXISTS ${SLEPC_SLEPCVERSION_H}) STRING(REGEX REPLACE "^.*SLEPC_VERSION_MINOR.*([0-9]+).*" "\\1" SLEPC_VERSION_MINOR "${SLEPC_VERSION_MINOR_STRING}" ) - FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_SUBMINOR_STRING REGEX "#define.*SLEPC_VERSION_SUBMINOR") STRING(REGEX REPLACE "^.*SLEPC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" SLEPC_VERSION_SUBMINOR "${SLEPC_VERSION_SUBMINOR_STRING}" ) - FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_PATCH_STRING REGEX "#define.*SLEPC_VERSION_PATCH") STRING(REGEX REPLACE "^.*SLEPC_VERSION_PATCH.*([0-9]+).*" "\\1" @@ -99,30 +90,9 @@ IF(EXISTS ${SLEPC_SLEPCVERSION_H}) ) ENDIF() -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG - SLEPC_LIBRARY - SLEPC_INCLUDE_DIR_ARCH - SLEPC_INCLUDE_DIR_COMMON - PETSC_FOUND +DEAL_II_PACKAGE_HANDLE(SLEPC + LIBRARIES + REQUIRED SLEPC_LIBRARY PETSC_LIBRARIES + INCLUDE_DIRS + REQUIRED SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON ) - -MARK_AS_ADVANCED( - SLEPC_DIR - SLEPC_INCLUDE_DIR_ARCH - SLEPC_INCLUDE_DIR_COMMON - SLEPC_INCLUDE_DIRS - SLEPC_LIBRARY - ) - -IF(SLEPC_FOUND) - SET(SLEPC_INCLUDE_DIRS - ${SLEPC_INCLUDE_DIR_ARCH} - ${SLEPC_INCLUDE_DIR_COMMON} - ) - SET(SLEPC_LIBRARIES - ${SLEPC_LIBRARY} - ${PETSC_LIBRARIES} - ) - MARK_AS_ADVANCED(SLEPC_DIR) -ENDIF() - diff --git a/deal.II/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake index 0efd5ef351..cf19170f4f 100644 --- a/deal.II/cmake/modules/FindTBB.cmake +++ b/deal.II/cmake/modules/FindTBB.cmake @@ -41,6 +41,9 @@ FIND_LIBRARY(TBB_LIBRARY PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) +# +# Also search for the debug library: +# FILE(GLOB _path ${TBB_DIR}/build/*_debug) FIND_LIBRARY(TBB_DEBUG_LIBRARY NAMES tbb_debug @@ -49,6 +52,12 @@ FIND_LIBRARY(TBB_DEBUG_LIBRARY ${TBB_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) +IF(NOT TBB_DEBUG_LIBRARY MATCHES "-NOTFOUND") + SET(TBB_WITH_DEBUGLIB TRUE) + SET(_libraries debug TBB_DEBUG_LIBRARY optimized TBB_LIBRARY) +ELSE() + SET(_libraries TBB_LIBRARY) +ENDIF() FIND_PATH(TBB_INCLUDE_DIR tbb/tbb_stddef.h HINTS @@ -72,27 +81,7 @@ IF(EXISTS ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h) ) ENDIF() -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG - TBB_LIBRARY - TBB_INCLUDE_DIR - ) - -MARK_AS_ADVANCED( - TBB_LIBRARY - TBB_DEBUG_LIBRARY - TBB_INCLUDE_DIR +DEAL_II_PACKAGE_HANDLE(TBB + LIBRARIES REQUIRED ${_libraries} + INCLUDE_DIRS REQUIRED TBB_INCLUDE_DIR ) - -IF(TBB_FOUND) - IF(NOT TBB_DEBUG_LIBRARY MATCHES "-NOTFOUND") - SET(TBB_WITH_DEBUGLIB TRUE) - SET(TBB_LIBRARIES debug ${TBB_DEBUG_LIBRARY} optimized ${TBB_LIBRARY}) - ELSE() - SET(TBB_LIBRARIES ${TBB_LIBRARY}) - ENDIF() - - SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) - - MARK_AS_ADVANCED(TBB_DIR) -ENDIF() - diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index fa266cce44..f1c493b05b 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -122,18 +122,17 @@ ENDIF() # # *Boy* Sanitize the include paths given by TrilinosConfig.cmake... # -SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS}) STRING(REGEX REPLACE "(lib64|lib)\\/cmake\\/Trilinos\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/" "" - TRILINOS_INCLUDE_DIRS "${TRILINOS_INCLUDE_DIRS}" + Trilinos_INCLUDE_DIRS "${Trilinos_INCLUDE_DIRS}" ) - # # We'd like to have the full library names but the Trilinos package only # exports a list with short names... # So we check again for every lib and store the full path: # +SET(_libraries "") FOREACH(_library ${Trilinos_LIBRARIES}) IF(_new_trilinos_config) UNSET(TRILINOS_LIBRARY_${_library} CACHE) @@ -150,32 +149,18 @@ FOREACH(_library ${Trilinos_LIBRARIES}) NO_CMAKE_FIND_ROOT_PATH ) - MARK_AS_ADVANCED(TRILINOS_LIBRARY_${_library}) - - LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${_library}}) - LIST(APPEND TRILINOS_LIBRARY_VARIABLES TRILINOS_LIBRARY_${_library}) - + LIST(APPEND _libraries TRILINOS_LIBRARY_${_library}) ENDFOREACH() -# -# Add the link interface: -# -LIST(APPEND TRILINOS_LIBRARIES - ${Trilinos_TPL_LIBRARIES} - ${MPI_CXX_LIBRARIES} # for good measure +DEAL_II_PACKAGE_HANDLE(TRILINOS + LIBRARIES + REQUIRED ${_libraries} Trilinos_TPL_LIBRARIES + OPTIONAL MPI_CXX_LIBRARIES + INCLUDE_DIRS + REQUIRED Trilinos_INCLUDE_DIRS ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TRILINOS DEFAULT_MSG - TRILINOS_LIBRARIES # cosmetic: Gives nice output - TRILINOS_CONFIG_FOUND - EPETRA_CONFIG_H - ${TRILINOS_LIBRARY_VARIABLES} - ) - -MARK_AS_ADVANCED(TRILINOS_CONFIG_DIR EPETRA_CONFIG_H) - IF(TRILINOS_FOUND) - # # Some versions of Sacado_cmath.hpp do things that aren't compatible # with the -std=c++0x flag of GCC, see deal.II FAQ. @@ -210,12 +195,7 @@ IF(TRILINOS_FOUND) ) RESET_CMAKE_REQUIRED() - MARK_AS_ADVANCED(TRILINOS_DIR) - ELSE() - SET(TRILINOS_LIBRARIES) - SET(TRILINOS_INCLUDE_DIRS) UNSET(TRILINOS_CONFIG_DIR_SAVED CACHE) ENDIF() - diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake index 96f5259224..0ab55c36b7 100644 --- a/deal.II/cmake/modules/FindUMFPACK.cmake +++ b/deal.II/cmake/modules/FindUMFPACK.cmake @@ -70,12 +70,6 @@ MACRO(FIND_UMFPACK_LIBRARY _comp _name) PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib Lib ${_comp}/Lib ) - IF(NOT "${ARGN}" STREQUAL "REQUIRED") - IF(${_comp}_LIBRARY MATCHES "-NOTFOUND") - SET(${_comp}_LIBRARY "") - UNSET(${_comp}_LIBRARY CACHE) - ENDIF() - ENDIF() ENDMACRO() @@ -85,24 +79,42 @@ ENDMACRO() FIND_UMFPACK_PATH(UMFPACK umfpack.h) FIND_UMFPACK_PATH(AMD amd.h) -# -# Well, recent versions of UMFPACK include SuiteSparse_config.h, if so, -# ensure that we'll find these headers as well. -# -IF(NOT UMFPACK_INCLUDE_DIR MATCHES "-NOTFOUND") +IF(EXISTS ${UMFPACK_INCLUDE_DIR}/umfpack.h) + # + # Well, recent versions of UMFPACK include SuiteSparse_config.h, if so, + # ensure that we'll find these headers as well. + # FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_SUITESPARSE_STRING REGEX "#include \"SuiteSparse_config.h\"") IF(NOT "${UMFPACK_SUITESPARSE_STRING}" STREQUAL "") FIND_UMFPACK_PATH(SuiteSparse_config SuiteSparse_config.h) - LIST(APPEND _required SuiteSparse_config_INCLUDE_DIR) ENDIF() + + FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_MAJOR_STRING + REGEX "#define.*UMFPACK_MAIN_VERSION") + STRING(REGEX REPLACE "^.*UMFPACK_MAIN_VERSION.*([0-9]+).*" "\\1" + UMFPACK_VERSION_MAJOR "${UMFPACK_VERSION_MAJOR_STRING}" + ) + FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_MINOR_STRING + REGEX "#define.*UMFPACK_SUB_VERSION") + STRING(REGEX REPLACE "^.*UMFPACK_SUB_VERSION.*([0-9]+).*" "\\1" + UMFPACK_VERSION_MINOR "${UMFPACK_VERSION_MINOR_STRING}" + ) + FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_SUBMINOR_STRING + REGEX "#define.*UMFPACK_SUBSUB_VERSION") + STRING(REGEX REPLACE "^.*UMFPACK_SUBSUB_VERSION.*([0-9]+).*" "\\1" + UMFPACK_VERSION_SUBMINOR "${UMFPACK_VERSION_SUBMINOR_STRING}" + ) + SET(UMFPACK_VERSION + "${UMFPACK_VERSION_MAJOR}.${UMFPACK_VERSION_MINOR}.${UMFPACK_VERSION_SUBMINOR}" + ) ENDIF() # # Link against everything we can find to avoid underlinkage: # -FIND_UMFPACK_LIBRARY(UMFPACK umfpack REQUIRED) -FIND_UMFPACK_LIBRARY(AMD amd REQUIRED) +FIND_UMFPACK_LIBRARY(UMFPACK umfpack) +FIND_UMFPACK_LIBRARY(AMD amd) FIND_UMFPACK_LIBRARY(CHOLMOD cholmod) FIND_UMFPACK_LIBRARY(COLAMD colamd) FIND_UMFPACK_LIBRARY(CCOLAMD ccolamd) @@ -123,94 +135,32 @@ CHECK_CXX_SOURCE_COMPILES("extern int SuiteSparse_version (int[3]); ) RESET_CMAKE_REQUIRED() -IF(EXISTS ${UMFPACK_INCLUDE_DIR}/umfpack.h) - FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_MAJOR_STRING - REGEX "#define.*UMFPACK_MAIN_VERSION") - STRING(REGEX REPLACE "^.*UMFPACK_MAIN_VERSION.*([0-9]+).*" "\\1" - UMFPACK_VERSION_MAJOR "${UMFPACK_VERSION_MAJOR_STRING}" - ) - FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_MINOR_STRING - REGEX "#define.*UMFPACK_SUB_VERSION") - STRING(REGEX REPLACE "^.*UMFPACK_SUB_VERSION.*([0-9]+).*" "\\1" - UMFPACK_VERSION_MINOR "${UMFPACK_VERSION_MINOR_STRING}" - ) - FILE(STRINGS "${UMFPACK_INCLUDE_DIR}/umfpack.h" UMFPACK_VERSION_SUBMINOR_STRING - REGEX "#define.*UMFPACK_SUBSUB_VERSION") - STRING(REGEX REPLACE "^.*UMFPACK_SUBSUB_VERSION.*([0-9]+).*" "\\1" - UMFPACK_VERSION_SUBMINOR "${UMFPACK_VERSION_SUBMINOR_STRING}" - ) - SET(UMFPACK_VERSION - "${UMFPACK_VERSION_MAJOR}.${UMFPACK_VERSION_MINOR}.${UMFPACK_VERSION_SUBMINOR}" - ) +IF(LAPACK_SUITESPARSECONFIG_WITH_PIC OR NOT BUILD_SHARED_LIBS) + SET(_suitesparse_config SuiteSparse_config_LIBRARY) ENDIF() -SET(_output ${UMFPACK_LIBRARY} ${CHOLMOD_LIBRARY} ${CCOLAMD_LIBRARY} ${COLAMD_LIBRARY} ${CAMD_LIBRARY} ${AMD_LIBRARY} ${SuiteSparse_config_LIBRARY}) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(UMFPACK DEFAULT_MSG - _output # Cosmetic: Gives nice output - UMFPACK_LIBRARY - AMD_LIBRARY - UMFPACK_INCLUDE_DIR - AMD_INCLUDE_DIR - ${_required} - LAPACK_FOUND - ) - -MARK_AS_ADVANCED( - AMD_INCLUDE_DIR - AMD_LIBRARY - atlas_LIBRARY - blas_LIBRARY - CAMD_LIBRARY - CHOLMOD_LIBRARY - CCOLAMD_LIBRARY - COLAMD_LIBRARY - SuiteSparse_config_INCLUDE_DIR - SuiteSparse_config_LIBRARY - UMFPACK_INCLUDE_DIR - UMFPACK_LIBRARY +# +# Add rt to the link interface as well (for whatever reason, +# libsuitesparse.so depends on clock_gettime but the shared +# lib does not record its dependence on librt.so as evidenced +# by ldd :-( ): +# +FIND_SYSTEM_LIBRARY(rt_LIBRARY NAMES rt) + +DEAL_II_PACKAGE_HANDLE(UMFPACK + LIBRARIES + REQUIRED UMFPACK_LIBRARY + OPTIONAL CHOLMOD_LIBRARY CCOLAMD_LIBRARY COLAMD_LIBRARY CAMD_LIBRARY ${_suitesparse_config} + REQUIRED AMD_LIBRARY + OPTIONAL METIS_LIBRARIES LAPACK_LIBRARIES rt_LIBRARY + INCLUDE_DIRS + REQUIRED UMFPACK_INCLUDE_DIR AMD_INCLUDE_DIR + OPTIONAL SuiteSparse_config_INCLUDE_DIR + LINKER_FLAGS + OPTIONAL LAPACK_LINKER_FLAGS ) - IF(UMFPACK_FOUND) - SET(UMFPACK_LIBRARIES - ${UMFPACK_LIBRARY} - ${CHOLMOD_LIBRARY} - ${CCOLAMD_LIBRARY} - ${COLAMD_LIBRARY} - ${CAMD_LIBRARY} - ${AMD_LIBRARY} - ) - IF(LAPACK_SUITESPARSECONFIG_WITH_PIC OR NOT BUILD_SHARED_LIBS) - LIST(APPEND UMFPACK_LIBRARIES ${SuiteSparse_config_LIBRARY}) - ENDIF() - - # - # For good measure: - # - IF(METIS_FOUND) - LIST(APPEND UMFPACK_LIBRARIES ${METIS_LIBRARIES}) - ENDIF() - - LIST(APPEND UMFPACK_LIBRARIES ${LAPACK_LIBRARIES}) - - # - # Add rt to the link interface as well (for whatever reason, - # libsuitesparse.so depends on clock_gettime but the shared - # lib does not record its dependence on librt.so as evidenced - # by ldd :-( ): - # - FIND_SYSTEM_LIBRARY(rt_LIBRARY NAMES rt) - MARK_AS_ADVANCED(rt_LIBRARY) - IF(NOT rt_LIBRARY MATCHES "-NOTFOUND") - LIST(APPEND UMFPACK_LIBRARIES ${rt_LIBRARY}) - ENDIF() - - SET(UMFPACK_INCLUDE_DIRS - ${UMFPACK_INCLUDE_DIR} - ${AMD_INCLUDE_DIR} - ${SuiteSparse_config_INCLUDE_DIR} - ) - SET(UMFPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS}) - - MARK_AS_ADVANCED(UMFPACK_DIR SUITESPARSE_DIR) + MARK_AS_ADVANCED(SUITESPARSE_DIR) ENDIF() +MARK_AS_ADVANCED(SuiteSparse_config_LIBRARY rt_LIBRARY) diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 22e0d65c08..4d228ea4ae 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -51,18 +51,6 @@ FOREACH(_flag ${DEAL_II_REMOVED_FLAGS}) ENDIF() ENDFOREACH() -# -# Deduplicate entries in *_INCLUDE_DIRS and *_LIBRARIES -# -FOREACH(_feature DEAL_II ${DEAL_II_FEATURES}) - FOREACH(_suffix INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS) - REMOVE_DUPLICATES(${_feature}_${_suffix}) - ENDFOREACH() - FOREACH(_suffix LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG) - REMOVE_DUPLICATES(${_feature}_${_suffix} REVERSE) - ENDFOREACH() -ENDFOREACH() - # # Save base configuration into variables BASE_* for later use in # setup_write_config.cmake: @@ -92,7 +80,11 @@ ENDFOREACH() FOREACH(_suffix INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS) REMOVE_DUPLICATES(DEAL_II_${_suffix}) ENDFOREACH() -FOREACH(_suffix LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG) +FOREACH(_suffix + LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG + USER_DEFINITIONS USER_DEFINITIONS_DEBUG USER_DEFINITIONS_RELEASE + DEFINITIONS DEFINITIONS_DEBUG DEFINITIONS_RELEASE + ) REMOVE_DUPLICATES(DEAL_II_${_suffix} REVERSE) ENDFOREACH()