Specify dependencies as one list, including args
Allow arguments to be used on the list of dependencies, this facilitates searching for things like e.g. Boost, and there is now only need for one list since REQUIRED can be one of the arguments.
This commit is contained in:
@@ -15,12 +15,11 @@ find_opm_package (
|
|||||||
# module name
|
# module name
|
||||||
"dune-common"
|
"dune-common"
|
||||||
|
|
||||||
# required dependencies
|
# dependencies
|
||||||
"BLAS;LAPACK"
|
"CXX11Features REQUIRED;
|
||||||
|
BLAS REQUIRED;
|
||||||
# optional dependencies
|
LAPACK REQUIRED
|
||||||
""
|
"
|
||||||
|
|
||||||
# header to search for
|
# header to search for
|
||||||
"dune/common/fvector.hh"
|
"dune/common/fvector.hh"
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ find_opm_package (
|
|||||||
"dune-istl"
|
"dune-istl"
|
||||||
|
|
||||||
# required dependencies
|
# required dependencies
|
||||||
"dune-common"
|
"dune-common REQUIRED;
|
||||||
|
SUPERLU
|
||||||
# optional dependencies
|
"
|
||||||
"SuperLU"
|
|
||||||
|
|
||||||
# header to search for
|
# header to search for
|
||||||
"dune/istl/bcrsmatrix.hh"
|
"dune/istl/bcrsmatrix.hh"
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,23 @@
|
|||||||
# Copyright (C) 2012 Uni Research AS
|
# Copyright (C) 2012 Uni Research AS
|
||||||
# This code is licensed under The GNU General Public License v3.0
|
# This code is licensed under The GNU General Public License v3.0
|
||||||
|
|
||||||
# these packages must be found specially, since they require arguments
|
# use the generic find routine
|
||||||
include (OpmFind)
|
|
||||||
find_and_append_package_to (opm-core SuiteSparse COMPONENTS umfpack)
|
|
||||||
find_and_append_package_to (opm-core Boost 1.39.0
|
|
||||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED)
|
|
||||||
include (UseDynamicBoost)
|
|
||||||
|
|
||||||
# use the generic find routine to handle the rest
|
|
||||||
include (OpmPackage)
|
include (OpmPackage)
|
||||||
find_opm_package (
|
find_opm_package (
|
||||||
# module name
|
# module name
|
||||||
"opm-core"
|
"opm-core"
|
||||||
|
|
||||||
# required dependencies
|
# dependencies
|
||||||
"CXX11Features;BLAS;LAPACK"
|
"CXX11Features REQUIRED;
|
||||||
|
BLAS REQUIRED;
|
||||||
# optional dependencies
|
LAPACK REQUIRED;
|
||||||
"dune-istl;SUPERLU"
|
SuiteSparse COMPONENTS umfpack;
|
||||||
|
SUPERLU;
|
||||||
|
LibXml2 REQUIRED;
|
||||||
|
Boost 1.39.0
|
||||||
|
COMPONENTS date_time filesystem system unit_test_framework REQUIRED;
|
||||||
|
dune-istl
|
||||||
|
"
|
||||||
# header to search for
|
# header to search for
|
||||||
"opm/core/grid.h"
|
"opm/core/grid.h"
|
||||||
|
|
||||||
@@ -56,4 +54,5 @@ int main (void) {
|
|||||||
HAVE_NULLPTR;
|
HAVE_NULLPTR;
|
||||||
HAVE_STATIC_ASSERT
|
HAVE_STATIC_ASSERT
|
||||||
")
|
")
|
||||||
|
include (UseDynamicBoost)
|
||||||
#debug_find_vars ("opm-core")
|
#debug_find_vars ("opm-core")
|
||||||
|
|||||||
@@ -2,17 +2,16 @@
|
|||||||
#
|
#
|
||||||
# Synopsis:
|
# Synopsis:
|
||||||
#
|
#
|
||||||
# find_opm_package (module deps opts header lib defs prog conf)
|
# find_opm_package (module deps header lib defs prog conf)
|
||||||
#
|
#
|
||||||
# where
|
# where
|
||||||
#
|
#
|
||||||
# module Name of the module, e.g. "dune-common"; this will be the
|
# module Name of the module, e.g. "dune-common"; this will be the
|
||||||
# stem of all variables defined (see below).
|
# stem of all variables defined (see below).
|
||||||
# reqs Semi-colon-separated list of dependent modules which must
|
# deps Semi-colon-separated list of dependent modules which must
|
||||||
# be present; all are required.
|
# be present; those that are required must be marked as such
|
||||||
# opts Semi-colon-separated list of dependent modules which not
|
# explicitly. Quote if more than one word is necessary to
|
||||||
# necessarily must be present but should be included if they
|
# describe the dependency.
|
||||||
# are.
|
|
||||||
# header Name of the header file to probe for, e.g.
|
# header Name of the header file to probe for, e.g.
|
||||||
# "dune/common/fvector.hh". Note that you should have to same
|
# "dune/common/fvector.hh". Note that you should have to same
|
||||||
# relative path here as is used in the header files.
|
# relative path here as is used in the header files.
|
||||||
@@ -56,23 +55,21 @@ macro (append_found src dst)
|
|||||||
endforeach (_item)
|
endforeach (_item)
|
||||||
endmacro (append_found src dst)
|
endmacro (append_found src dst)
|
||||||
|
|
||||||
function (find_opm_package module reqs opts header lib defs prog conf)
|
function (find_opm_package module deps header lib defs prog conf)
|
||||||
# if someone else has included this test, don't do it again
|
# if someone else has included this test, don't do it again
|
||||||
if (${${module}_FOUND})
|
if (${${module}_FOUND})
|
||||||
return ()
|
return ()
|
||||||
endif (${${module}_FOUND})
|
endif (${${module}_FOUND})
|
||||||
|
|
||||||
# dependencies on other packages
|
# dependencies on other packages; underscore version only contains the
|
||||||
foreach (_dep IN LISTS reqs)
|
# name of the other package
|
||||||
find_package (${_dep} QUIET REQUIRED)
|
set (_deps)
|
||||||
|
foreach (_dep IN LISTS deps)
|
||||||
|
separate_arguments (_args UNIX_COMMAND ${_dep})
|
||||||
|
find_package (${_args} QUIET)
|
||||||
|
list (GET _args 0 _name_only)
|
||||||
|
list (APPEND _deps ${_name_only})
|
||||||
endforeach (_dep)
|
endforeach (_dep)
|
||||||
foreach (_dep IN LISTS opts)
|
|
||||||
find_package (${_dep} QUIET)
|
|
||||||
endforeach (_dep)
|
|
||||||
set (_deps ${reqs} ${opts})
|
|
||||||
|
|
||||||
# compile with C++0x/11 support if available
|
|
||||||
find_package (CXX11Features REQUIRED)
|
|
||||||
|
|
||||||
# see if there is a pkg-config entry for this package, and use those
|
# see if there is a pkg-config entry for this package, and use those
|
||||||
# settings as a starting point
|
# settings as a starting point
|
||||||
@@ -181,7 +178,7 @@ function (find_opm_package module reqs opts header lib defs prog conf)
|
|||||||
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE)
|
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}" PARENT_SCOPE)
|
||||||
set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE)
|
set (${module}_CONFIG_VARS "${${module}_CONFIG_VARS}" PARENT_SCOPE)
|
||||||
set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE)
|
set (HAVE_${MODULE} "${HAVE_${MODULE}}" PARENT_SCOPE)
|
||||||
endfunction (find_opm_package module reqs opts header lib defs prog conf)
|
endfunction (find_opm_package module deps header lib defs prog conf)
|
||||||
|
|
||||||
# print all variables defined by the above macro
|
# print all variables defined by the above macro
|
||||||
function (debug_find_vars module)
|
function (debug_find_vars module)
|
||||||
|
|||||||
Reference in New Issue
Block a user