From 8a51f00b9d68363d7b84f0cd9e3aa10712da094e Mon Sep 17 00:00:00 2001 From: maier Date: Mon, 17 Sep 2012 09:16:24 +0000 Subject: [PATCH] Refactor the configure_feature macro git-svn-id: https://svn.dealii.org/branches/branch_cmake@26427 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 2 +- .../cmake/configure/configure_blas.cmake | 16 +-- .../cmake/configure/configure_boost.cmake | 24 +--- .../configure/configure_functionparser.cmake | 26 ++--- .../cmake/configure/configure_lapack.cmake | 16 +-- .../cmake/configure/configure_metis.cmake | 33 ++---- .../cmake/configure/configure_mpi.cmake | 9 +- .../cmake/configure/configure_netcdf.cmake | 20 +--- .../cmake/configure/configure_tbb.cmake | 26 +---- .../cmake/configure/configure_umfpack.cmake | 20 ++-- .../cmake/configure/configure_zlib.cmake | 16 +-- .../macros/macro_configure_feature.cmake | 108 +++++++++++++----- 12 files changed, 130 insertions(+), 186 deletions(-) diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index ef1ada3c48..26be28f67c 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -132,7 +132,7 @@ OPTION(DEAL_II_FORCE_CONTRIB_TBB OPTION(DEAL_II_WITH_UMFPACK "Build deal.II with support for UMFPACK." - OFF) + ON) OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK "Always use the bundled umfpack library instead of an external one." OFF) diff --git a/deal.II/contrib/cmake/configure/configure_blas.cmake b/deal.II/contrib/cmake/configure/configure_blas.cmake index 8dca2da1b6..71a4db091d 100644 --- a/deal.II/contrib/cmake/configure/configure_blas.cmake +++ b/deal.II/contrib/cmake/configure/configure_blas.cmake @@ -4,7 +4,7 @@ INCLUDE(CheckFunctionExists) -MACRO(FIND_FEATURE_BLAS_EXTERNAL var) +MACRO(FEATURE_BLAS_FIND_EXTERNAL var) FIND_PACKAGE(BLAS) @@ -15,7 +15,7 @@ MACRO(FIND_FEATURE_BLAS_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BLAS_EXTERNAL var) +MACRO(FEATURE_BLAS_CONFIGURE_EXTERNAL var) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}" @@ -58,16 +58,4 @@ MACRO(CONFIGURE_FEATURE_BLAS_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BLAS_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the blas library! - -Please ensure that the blas library is installed on your computer. -If the library is not at a default location, either provide some hints -for the autodetection, or set the relevant variables by hand in ccmake. - -") -ENDMACRO() - - CONFIGURE_FEATURE(BLAS) diff --git a/deal.II/contrib/cmake/configure/configure_boost.cmake b/deal.II/contrib/cmake/configure/configure_boost.cmake index 7ce09063bc..e1b985eea4 100644 --- a/deal.II/contrib/cmake/configure/configure_boost.cmake +++ b/deal.II/contrib/cmake/configure/configure_boost.cmake @@ -8,7 +8,7 @@ SET(DEAL_II_WITH_BOOST "ON" ) -MACRO(FIND_FEATURE_BOOST_EXTERNAL var) +MACRO(FEATURE_BOOST_FIND_EXTERNAL var) FIND_PACKAGE (Boost COMPONENTS serialization thread) @@ -22,7 +22,7 @@ MACRO(FIND_FEATURE_BOOST_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BOOST_EXTERNAL var) +MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIR}) @@ -40,10 +40,10 @@ MACRO(CONFIGURE_FEATURE_BOOST_EXTERNAL var) ENDMACRO() -SET(HAVE_CONTRIB_FEATURE_BOOST TRUE) +SET(FEATURE_BOOST_HAVE_CONTRIB TRUE) -MACRO(CONFIGURE_FEATURE_BOOST_CONTRIB var) +MACRO(FEATURE_BOOST_CONFIGURE_CONTRIB var) # compile the necessary parts of boost out of ./contrib @@ -79,20 +79,4 @@ MACRO(CONFIGURE_FEATURE_BOOST_CONTRIB var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BOOST_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the boost library! - -Please ensure that the boost library is installed on your computer. -If the library is not at a default location, either provide some hints -for the autodetection, or set the relevant variables by hand in ccmake. - -Alternatively you may choose to compile the bundled contrib library of -boost by setting DEAL_II_ALLOW_CONTRIB=on or -DEAL_II_FORCE_CONTRIB_BOOST=on. - -") -ENDMACRO() - - CONFIGURE_FEATURE(BOOST) diff --git a/deal.II/contrib/cmake/configure/configure_functionparser.cmake b/deal.II/contrib/cmake/configure/configure_functionparser.cmake index 39dcf61d3c..77e2237367 100644 --- a/deal.II/contrib/cmake/configure/configure_functionparser.cmake +++ b/deal.II/contrib/cmake/configure/configure_functionparser.cmake @@ -1,15 +1,19 @@ -MACRO(FIND_FEATURE_FUNCTIONPARSER_EXTERNAL var) +MACRO(FEATURE_FUNCTIONPARSER_FIND_EXTERNAL var) + MESSAGE(WARNING " +Module for finding functionparser not written, yet! + +") ENDMACRO() -MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_EXTERNAL var) +MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_EXTERNAL var) ENDMACRO() -SET(HAVE_CONTRIB_FEATURE_FUNCTIONPARSER TRUE) +SET(FEATURE_FUNCTIONPARSER_HAVE_CONTRIB TRUE) -MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_CONTRIB var) +MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_CONTRIB var) # compile the necessary parts of functionparser out of ./contrib @@ -32,18 +36,4 @@ MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_CONTRIB var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_FUNCTIONPARSER_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the functionparser library! - -Module not written, yet... - -You may want to choose to compile the bundled contrib library of -functionparser by setting DEAL_II_ALLOW_CONTRIB=on or -DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER=on. - -") -ENDMACRO() - - CONFIGURE_FEATURE(FUNCTIONPARSER) diff --git a/deal.II/contrib/cmake/configure/configure_lapack.cmake b/deal.II/contrib/cmake/configure/configure_lapack.cmake index b7507df24d..532f5a8c27 100644 --- a/deal.II/contrib/cmake/configure/configure_lapack.cmake +++ b/deal.II/contrib/cmake/configure/configure_lapack.cmake @@ -2,7 +2,7 @@ # Configuration for the lapack library: # -MACRO(FIND_FEATURE_LAPACK_EXTERNAL var) +MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) FIND_PACKAGE(LAPACK) @@ -13,7 +13,7 @@ MACRO(FIND_FEATURE_LAPACK_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_LAPACK_EXTERNAL var) +MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}" @@ -58,16 +58,4 @@ MACRO(CONFIGURE_FEATURE_LAPACK_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BLAS_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the lapack library! - -Please ensure that the lapack library is installed on your computer. -If the library is not at a default location, either provide some hints -for the autodetection, or set the relevant variables by hand in ccmake. - -") -ENDMACRO() - - CONFIGURE_FEATURE(LAPACK) diff --git a/deal.II/contrib/cmake/configure/configure_metis.cmake b/deal.II/contrib/cmake/configure/configure_metis.cmake index c7f8e24177..385b42df0c 100644 --- a/deal.II/contrib/cmake/configure/configure_metis.cmake +++ b/deal.II/contrib/cmake/configure/configure_metis.cmake @@ -2,23 +2,30 @@ # Configuration for the netcdf library: # -MACRO(FIND_FEATURE_METIS_EXTERNAL var) +MACRO(FEATURE_METIS_FIND_EXTERNAL var) FIND_PACKAGE(METIS) IF(METIS_FOUND AND METIS_MAJOR GREATER 4) SET(${var} TRUE) ELSE() - MESSAGE(STATUS - "Could not find a sufficient modern metis installation: Version 5.x - required." + MESSAGE(WARNING " +Could not find a sufficient modern metis installation: +Version 5.x required! + +Please ensure that a sufficiently modern version of metis is installed on +your computer. If the library is not at a default location, either provide +some hints for the autodetection, or set the relevant variables by hand in +ccmake. + +" ) ENDIF() ENDMACRO() -MACRO(CONFIGURE_FEATURE_METIS_EXTERNAL var) +MACRO(FEATURE_METIS_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES(${METIS_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries ${METIS_LIBRARY}) @@ -29,20 +36,4 @@ MACRO(CONFIGURE_FEATURE_METIS_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_METIS_ERROR_MESSAGE) - - MESSAGE(SEND_ERROR " -Could not find the metis library! - -Please ensure that the metis version 5.x is installed on your computer. -If the library is not at a default location, either provide some hints -via environment variables: -METIS_LIBRARY_DIR METIS_INCLUDE_DIR -Or set the relevant variables by hand in ccmake. - -") - -ENDMACRO() - - CONFIGURE_FEATURE(METIS) diff --git a/deal.II/contrib/cmake/configure/configure_mpi.cmake b/deal.II/contrib/cmake/configure/configure_mpi.cmake index 322ad8ac9f..1c1b8eae4a 100644 --- a/deal.II/contrib/cmake/configure/configure_mpi.cmake +++ b/deal.II/contrib/cmake/configure/configure_mpi.cmake @@ -2,7 +2,7 @@ # Configuration for mpi support: # -MACRO(FIND_FEATURE_MPI_EXTERNAL var) +MACRO(FEATURE_MPI_FIND_EXTERNAL var) FIND_PACKAGE(MPI) @@ -13,7 +13,7 @@ MACRO(FIND_FEATURE_MPI_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_MPI_EXTERNAL var) +MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH}) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}") @@ -22,6 +22,8 @@ MACRO(CONFIGURE_FEATURE_MPI_EXTERNAL var) SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE) + # TODO: Set up the rest: + #MPI_CXX_COMPILER MPI Compiler wrapper for CXX #MPI_CXX_COMPILE_FLAGS Compilation flags for MPI programs @@ -36,8 +38,9 @@ MACRO(CONFIGURE_FEATURE_MPI_EXTERNAL var) SET(${var} TRUE) ENDMACRO() +SET(FEATURE_MPI_CUSTOM_ERROR_MESSAGE TRUE) -MACRO(CONFIGURE_FEATURE_MPI_ERROR_MESSAGE) +MACRO(FEATURE_MPI_ERROR_MESSAGE) MESSAGE(SEND_ERROR " Could not find any suitable mpi library! diff --git a/deal.II/contrib/cmake/configure/configure_netcdf.cmake b/deal.II/contrib/cmake/configure/configure_netcdf.cmake index 102d19400d..e5f2eba600 100644 --- a/deal.II/contrib/cmake/configure/configure_netcdf.cmake +++ b/deal.II/contrib/cmake/configure/configure_netcdf.cmake @@ -2,7 +2,7 @@ # Configuration for the netcdf library: # -MACRO(FIND_FEATURE_NETCDF_EXTERNAL var) +MACRO(FEATURE_NETCDF_FIND_EXTERNAL var) FIND_PACKAGE(NETCDF) @@ -13,7 +13,7 @@ MACRO(FIND_FEATURE_NETCDF_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_NETCDF_EXTERNAL var) +MACRO(FEATURE_NETCDF_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIR}) LIST(APPEND deal_ii_external_libraries ${NETCDF_LIBRARY}) @@ -23,20 +23,4 @@ MACRO(CONFIGURE_FEATURE_NETCDF_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_NETCDF_ERROR_MESSAGE) - - MESSAGE(SEND_ERROR " -Could not find the netcdf library! - -Please ensure that the netcdf library is installed on your computer. -If the library is not at a default location, either provide some hints -via environment variables: -NETCDF_LIBRARY_DIR NETCDF_INCLUDE_DIR -Or set the relevant variables by hand in ccmake. - -") - -ENDMACRO() - - CONFIGURE_FEATURE(NETCDF) diff --git a/deal.II/contrib/cmake/configure/configure_tbb.cmake b/deal.II/contrib/cmake/configure/configure_tbb.cmake index 5f1e21432b..e8883da6e7 100644 --- a/deal.II/contrib/cmake/configure/configure_tbb.cmake +++ b/deal.II/contrib/cmake/configure/configure_tbb.cmake @@ -84,7 +84,7 @@ ENDMACRO() # Set up the tbb library: # -MACRO(FIND_FEATURE_TBB_EXTERNAL var) +MACRO(FEATURE_TBB_FIND_EXTERNAL var) FIND_PACKAGE(TBB) @@ -100,7 +100,7 @@ MACRO(FIND_FEATURE_TBB_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_TBB_EXTERNAL var) +MACRO(FEATURE_TBB_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR}) @@ -115,10 +115,10 @@ MACRO(CONFIGURE_FEATURE_TBB_EXTERNAL var) ENDMACRO() -SET(HAVE_CONTRIB_FEATURE_TBB TRUE) +SET(FEATURE_TBB_HAVE_CONTRIB TRUE) -MACRO(CONFIGURE_FEATURE_TBB_CONTRIB var) +MACRO(FEATURE_TBB_CONFIGURE_CONTRIB var) # # Add tbb directly to the object files of deal.II # @@ -139,22 +139,4 @@ MACRO(CONFIGURE_FEATURE_TBB_CONTRIB var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_TBB_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the tbb library! - -Please ensure that the tbb library is installed on your computer. -If the library is not at a default location, either provide some hints -via environment variables: -TBB_LIBRARY_DIR TBB_INCLUDE_DIR -Or set the relevant variables by hand in ccmake. - -Alternatively you may choose to compile the bundled contrib library of -boost by setting DEAL_II_ALLOW_CONTRIB=on or -DEAL_II_FORCE_CONTRIB_TBB=on. - -") -ENDMACRO() - - CONFIGURE_FEATURE(TBB) diff --git a/deal.II/contrib/cmake/configure/configure_umfpack.cmake b/deal.II/contrib/cmake/configure/configure_umfpack.cmake index 98018cf35b..592f0d72be 100644 --- a/deal.II/contrib/cmake/configure/configure_umfpack.cmake +++ b/deal.II/contrib/cmake/configure/configure_umfpack.cmake @@ -9,19 +9,19 @@ SET(FEATURE_UMFPACK_DEPENDS ) -MACRO(FIND_FEATURE_UMFPACK_EXTERNAL var) +MACRO(FEATURE_UMFPACK_FIND_EXTERNAL var) FIND_PACKAGE(UMFPACK) FIND_PACKAGE(AMD) IF(UMFPACK_FOUND AND AMD_FOUND) - SET(${var} TRUE) + #SET(${var} TRUE) ENDIF() ENDMACRO() -MACRO(CONFIGURE_FEATURE_UMFPACK_EXTERNAL var) +MACRO(FEATURE_UMFPACK_CONFIGURE_EXTERNAL var) INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIR} ${AMD_INCLUDE_DIR}) @@ -36,10 +36,10 @@ MACRO(CONFIGURE_FEATURE_UMFPACK_EXTERNAL var) ENDMACRO() -SET(HAVE_CONTRIB_FEATURE_UMFPACK TRUE) +SET(FEATURE_UMFPACK_HAVE_CONTRIB TRUE) -MACRO(CONFIGURE_FEATURE_UMFPACK_CONTRIB var) +MACRO(FEATURE_UMFPACK_CONFIGURE_CONTRIB var) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/contrib/umfpack/UMFPACK/Include @@ -66,16 +66,16 @@ MACRO(CONFIGURE_FEATURE_UMFPACK_CONTRIB var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_BOOST_ERROR_MESSAGE) +SET(FEATURE_UMFPACK_CUSTOM_ERROR_MESSAGE TRUE) + + +MACRO(FEATURE_UMFPACK_ERROR_MESSAGE) MESSAGE(SEND_ERROR " Could not find the umfpack and amd libraries! Please ensure that the libraries are installed on your computer. If the libraries are not at a default location, either provide some hints -via environment variables: -UMFPACK_LIBRARY_DIR UMFPACK_INCLUDE_DIR -AMD_LIBRARY_DIR AMD_INCLUDE_DIR -Or set the relevant variables by hand in ccmake. +for the autodetection, or set the relevant variables by hand in ccmake. Alternatively you may choose to compile the bundled contrib libraries by setting DEAL_II_ALLOW_CONTRIB=on or DEAL_II_FORCE_CONTRIB_UMFPACK=on. diff --git a/deal.II/contrib/cmake/configure/configure_zlib.cmake b/deal.II/contrib/cmake/configure/configure_zlib.cmake index ef98798230..29e9c93faf 100644 --- a/deal.II/contrib/cmake/configure/configure_zlib.cmake +++ b/deal.II/contrib/cmake/configure/configure_zlib.cmake @@ -2,7 +2,7 @@ # Configuration for the zlib library: # -MACRO(FIND_FEATURE_ZLIB_EXTERNAL var) +MACRO(FEATURE_ZLIB_FIND_EXTERNAL var) FIND_PACKAGE(ZLIB) @@ -13,7 +13,7 @@ MACRO(FIND_FEATURE_ZLIB_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_ZLIB_EXTERNAL var) +MACRO(FEATURE_ZLIB_FIND_EXTERNAL var) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) LIST(APPEND deal_ii_external_libraries ${ZLIB_LIBRARIES}) @@ -24,16 +24,4 @@ MACRO(CONFIGURE_FEATURE_ZLIB_EXTERNAL var) ENDMACRO() -MACRO(CONFIGURE_FEATURE_ZLIB_ERROR_MESSAGE) - MESSAGE(SEND_ERROR " -Could not find the zlib library! - -Please ensure that the zlib library is installed on your computer. -If the library is not at a default location, either provide some hints -for the autodetection, or set the relevant variables by hand in ccmake. - -") -ENDMACRO() - - CONFIGURE_FEATURE(ZLIB) diff --git a/deal.II/contrib/cmake/macros/macro_configure_feature.cmake b/deal.II/contrib/cmake/macros/macro_configure_feature.cmake index b163f125b5..d8cfb063ae 100644 --- a/deal.II/contrib/cmake/macros/macro_configure_feature.cmake +++ b/deal.II/contrib/cmake/macros/macro_configure_feature.cmake @@ -3,43 +3,52 @@ # # Usage: # -# CONFIGURE_FEATURE(feature_name) +# CONFIGURE_FEATURE(feature) +# # # This macro assumes the following macros and variables to be defined: # -# FEATURE_${feature_name}_DEPENDS (variable) +# FEATURE_${feature}_DEPENDS (variable, optional) # -# - A variable which contains an optional list of features this feature +# a variable which contains an optional list of features this feature # depends on (and which have to be enbled for this feature to work.) # -# HAVE_CONTRIB_FEATURE_${feature_name} (variable) # -# - Which is either set to TRUE if all necessary libraries of the -# features comes bundled with deal.II and hence can be supported -# without external dependencies, or unset. +# FEATURE_${feature}_HAVE_CONTRIB (variable, optional) +# +# which shall either be set to TRUE if all necessary libraries of the +# features comes bundled with deal.II and hence can be supported +# without external dependencies, or unset. +# +# FEATURE_${feature}_CONFIGURE_CONTRIB(var) (macro, optional) +# +# which shall setup all necessary configuration for the feature with +# contrib source dependencies. var set to TRUE shall indicate success. # -# CONFIGURE_FEATURE_${feature_name}_CONTRIB(var) (macro) # -# - which shall setup all necessary configuration for the feature with -# contrib source dependencies. var set to TRUE shall indicate success. +# FEATURE_${feature}_FIND_EXTERNAL(var) (macro) # +# which shall set var to TRUE if all dependencies for the feature are +# fullfilled. In this case all necessary variables for +# FEATURE_${feature}_CONFIGURE_EXTERNAL must be set. Otherwise +# var should remain unset. # -# FIND_FEATURE_${feature_name}_EXTERNAL(var) (macro) +# FEATURE_${feature}_CONFIGURE_EXTERNAL(var) (macro) # -# - which shall set var to TRUE if all dependencies for the feature are -# fullfilled. In this case all necessary variables for -# CONFIGURE_FEATURE_${feature_name}_EXTERNAL shall be set. Otherwise -# var should remain unset. +# which shall setup all necessary configuration for the feature with +# external dependencies. var set to TRUE shall indicate success. # -# CONFIGURE_FEATURE_${feature_name}_EXTERNAL(var) (macro) # -# - which shall setup all necessary configuration for the feature with -# external dependencies. var set to TRUE shall indicate success. +# FEATURE_${feature}_CUSTOM_ERROR_MESSAGE() (variable, optional) # -# CONFIGURE_FEATURE_${feature_name}_ERROR_MESSAGE() (macro) +# which shall either be set to TRUE if FEATURE_${feature}_ERROR_MESSAGE +# is set up, or be undefined. # -# - which shall print a meaningfull error message if case no external -# library is found (and contrib is not allowed to be used.) +# FEATURE_${feature}_ERROR_MESSAGE() (macro, optional) +# +# which shall print a meaningfull error message if case no external +# library is found (and contrib is not allowed to be used.) +# If not defined, a suitable default error message will be printed. # # @@ -73,6 +82,37 @@ MACRO(SET_CACHED_OPTION str value) ENDMACRO() +# +# A small macro to post an error message: +# +MACRO(FEATURE_ERROR_MESSAGE feature) + STRING(TOLOWER ${feature} feature_lowercase) + IF(FEATURE_${feature}_HAVE_CONTRIB) + MESSAGE(SEND_ERROR " +Could not find the ${feature_lowercase} library! + +Please ensure that the ${feature_lowercase} library is installed on your computer. +If the library is not at a default location, either provide some hints +for the autodetection, or set the relevant variables by hand in ccmake. + +Alternatively you may choose to compile the bundled contrib library of +${feature_lowercase} by setting DEAL_II_ALLOW_CONTRIB=on or +DEAL_II_FORCE_CONTRIB_${feature}=on. + +") + ELSE() + MESSAGE(SEND_ERROR " +Could not find the ${feature_lowercase} library! + +Please ensure that the ${feature_lowercase} library is installed on your computer. +If the library is not at a default location, either provide some hints +for the autodetection, or set the relevant variables by hand in ccmake. + +") + ENDIF() +ENDMACRO() + + MACRO(CONFIGURE_FEATURE feature) # Only try to configure ${feature} if we have to: @@ -108,10 +148,10 @@ MACRO(CONFIGURE_FEATURE feature) # IF(DEAL_II_FORCE_CONTRIB_${feature}) - IF(HAVE_CONTRIB_FEATURE_${feature}) + IF(FEATURE_${feature}_HAVE_CONTRIB) RUN_COMMAND( " - CONFIGURE_FEATURE_${feature}_CONTRIB( + FEATURE_${feature}_CONFIGURE_CONTRIB( FEATURE_${feature}_CONTRIB_CONFIGURED ) " @@ -131,7 +171,7 @@ MACRO(CONFIGURE_FEATURE feature) ENDIF() ELSE() MESSAGE(FATAL_ERROR - "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present." + "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but FEATURE_${feature}_HAVE_CONTRIB not present." ) ENDIF() @@ -141,7 +181,7 @@ MACRO(CONFIGURE_FEATURE feature) # Second case: We are allowed to search for an external library: # RUN_COMMAND( - "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)" + "FEATURE_${feature}_FIND_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)" ) IF(FEATURE_${feature}_EXTERNAL_FOUND) @@ -152,7 +192,7 @@ MACRO(CONFIGURE_FEATURE feature) RUN_COMMAND( " - CONFIGURE_FEATURE_${feature}_EXTERNAL( + FEATURE_${feature}_CONFIGURE_EXTERNAL( FEATURE_${feature}_EXTERNAL_CONFIGURED ) " @@ -178,10 +218,10 @@ MACRO(CONFIGURE_FEATURE feature) "DEAL_II_WITH_${feature} has unmet external dependencies." ) - IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB) + IF(FEATURE_${feature}_HAVE_CONTRIB AND DEAL_II_ALLOW_CONTRIB) RUN_COMMAND( " - CONFIGURE_FEATURE_${feature}_CONTRIB( + FEATURE_${feature}_CONFIGURE_CONTRIB( FEATURE_${feature}_CONTRIB_CONFIGURED ) " @@ -203,9 +243,15 @@ MACRO(CONFIGURE_FEATURE feature) IF(DEAL_II_FEATURE_AUTODETECTION) SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON) ELSE() - RUN_COMMAND( - "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()" - ) + IF(FEATURE_${feature}_CUSTOM_ERROR_MESSAGE) + RUN_COMMAND( + " + FEATURE_${feature}_ERROR_MESSAGE() + " + ) + ELSE() + FEATURE_ERROR_MESSAGE(${feature}) + ENDIF() ENDIF() ENDIF() ENDIF() -- 2.39.5