Merge pull request #223 from rolk/223_cmake

CMake rollup
This commit is contained in:
Atgeirr Flø Rasmussen 2013-04-03 03:19:03 -07:00
commit fa43244633
3 changed files with 61 additions and 0 deletions

View File

@ -59,6 +59,10 @@ set (_opm_proj_exemptions
dune-geometry
)
# although a DUNE module, it is delivered in the OPM suite
set (dune-cornerpoint_SUITE "opm")
set (ewoms_SUITE "opm")
# insert this boilerplate whenever we are going to find a new package
macro (find_and_append_package_to prefix name)
# special handling for Boost to avoid inadvertedly picking up system
@ -73,6 +77,26 @@ macro (find_and_append_package_to prefix name)
# system default paths afterwards
string (TOUPPER "${name}" NAME)
string (REPLACE "-" "_" NAME "${NAME}")
# only use suite if module-specific variable is not set. this allows
# us to override one dir in a suite
if (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
# module is part of a suite if it has name with the pattern xxx-yyy
if (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
# allow to override if the module doesn't quite fit the convention
# e.g. dune-cornerpoint
if (NOT DEFINED ${name}_SUITE)
# extract suite name from module
string (REGEX REPLACE "([^-]+)-.+" "\\1" ${name}_SUITE "${name}")
endif (NOT DEFINED ${name}_SUITE)
# assume that each module has its own subdir directly under suite dir
string (TOUPPER "${${name}_SUITE}" ${name}_SUITE_UPPER)
if (DEFINED ${${name}_SUITE_UPPER}_ROOT)
set (${NAME}_ROOT ${${${name}_SUITE_UPPER}_ROOT}/${name})
endif (DEFINED ${${name}_SUITE_UPPER}_ROOT)
endif (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
endif (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
# the documentation says that if *-config.cmake files are not found,
# find_package will revert to doing a full search, but that is not
# true, so unconditionally setting ${name}_DIR is not safe. however,

View File

@ -123,6 +123,18 @@ macro (find_opm_package module deps header lib defs prog conf)
${${module}_ROOT}
${${MODULE}_ROOT}
)
# if every package is installed directly in the "suite" directory
# (e.g. /usr) then allow us to back-track one directory from the
# module sub-dir that was added by OpmFind (this happens incidently
# already for the source do to the out-of-source support)
if ("${${MODULE}_ROOT}" MATCHES "/${module}$")
get_filename_component (_suite_parent ${${MODULE}_ROOT} PATH)
list (APPEND _guess_bin
${_suite_parent}
${_suite_parent}/${module}
${_suite_parent}/${module}/${_build_dir}
)
endif ("${${MODULE}_ROOT}" MATCHES "/${module}$")
# when we look for the source, it may be that we have been specified
# a build directory which is a sub-dir of the source, so we look in
# the parent also
@ -239,9 +251,24 @@ macro (find_opm_package module deps header lib defs prog conf)
include (FindPackageHandleStandardArgs)
if ("${lib}" STREQUAL "")
set (_lib_var "")
set (_and_lib_var)
else ("${lib}" STREQUAL "")
set (_lib_var "${module}_LIBRARY")
set (_and_lib_var AND ${_lib_var})
endif ("${lib}" STREQUAL "")
# if the search is going to fail, then write these variables to
# the console as well as a diagnostics
if (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE})
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
if (DEFINED ${module}_DIR)
message ("${module}_DIR = ${${module}_DIR}")
elseif (DEFINED ${module}_ROOT)
message ("${module}_ROOT = ${${module}_ROOT}")
elseif (DEFINED ${MODULE}_ROOT)
message ("${MODULE}_ROOT = ${${MODULE}_ROOT}")
endif (DEFINED ${module}_DIR)
endif (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE})
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
find_package_handle_standard_args (
${module}
DEFAULT_MSG

10
configure vendored
View File

@ -28,7 +28,9 @@ Optional Features:
Optional Packages:
--with-boost=PATH use Boost library from a specified location
--with-dune=PATH specify parent of all DUNE modules not specified
--with-dune-MODULE=PATH use given DUNE module from a specified location
--with-opm=PATH specify parent of all OPM modules not specified
--with-opm-MODULE=PATH use given OPM module from a specified location
--with-superlu=PATH user defined path to SuperLU library
--with-agmg=PATH Include DOUBLE PRECISION version Notay's of AGMG
@ -164,13 +166,19 @@ for OPT in "$@"; do
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
rootvar=""
;;
mpi |\
mpi-prefix)
rootvar="_MPI_PREFIX_PATH"
;;
agmg |\
ert |\
boost |\
superlu |\
SuiteSparse |\
TinyXML |\
opm |\
opm-* |\
dune |\
dune-* |\
zlib)
rootvar="${pkgname^^}_ROOT"
@ -228,6 +236,7 @@ for OPT in "$@"; do
use_openmp=" -DUSE_OPENMP=OFF"
pkgname=""
;;
mpi | \
parallel)
use_mpi=" -DUSE_MPI=OFF"
pkgname=""
@ -266,6 +275,7 @@ for OPT in "$@"; do
# special flag; don't set shared/static
shared=""
;;
mpi | \
parallel)
use_openmp=" -DUSE_MPI=ON"
# special flag; don't set shared/static