Merge pull request #322 from rolk/322_req
Propagate "requiredness" to prerequisites depending on the package's level
This commit is contained in:
commit
14b2d65319
@ -389,4 +389,6 @@ if(CXX_FEATURES_MISSING)
|
|||||||
"Your compiler does not seem to implement the following features:\n"
|
"Your compiler does not seem to implement the following features:\n"
|
||||||
"${CXX_FEATURES_MISSING}")
|
"${CXX_FEATURES_MISSING}")
|
||||||
endif()
|
endif()
|
||||||
|
else ()
|
||||||
|
set (CXX11FEATURES_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -15,3 +15,9 @@ int main(void){
|
|||||||
int status;
|
int status;
|
||||||
char *demangled = abi::__cxa_demangle( foo, 0, 0, &status );
|
char *demangled = abi::__cxa_demangle( foo, 0, 0, &status );
|
||||||
}" HAVE_CXA_DEMANGLE)
|
}" HAVE_CXA_DEMANGLE)
|
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs)
|
||||||
|
# prevent useless message from being displayed
|
||||||
|
set (FIND_PACKAGE_MESSAGE_DETAILS_CxaDemangle "[1][v()]"
|
||||||
|
CACHE INTERNAL "Details about finding CxaDemangle")
|
||||||
|
find_package_handle_standard_args (CxaDemangle DEFAULT_MSG HAVE_CXA_DEMANGLE)
|
||||||
|
@ -10,20 +10,13 @@
|
|||||||
# 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
|
||||||
|
|
||||||
# dune-common is only required if dune-istl is; the "required-ness" is
|
|
||||||
# not transitive as far as CMake is concerned (i.e. if an optional package
|
|
||||||
# requests a package to be required, the build will fail if it's not found)
|
|
||||||
if (dune-istl_FIND_REQUIRED)
|
|
||||||
set (_require_dune_common "REQUIRED")
|
|
||||||
endif (dune-istl_FIND_REQUIRED)
|
|
||||||
|
|
||||||
include (OpmPackage)
|
include (OpmPackage)
|
||||||
find_opm_package (
|
find_opm_package (
|
||||||
# module name
|
# module name
|
||||||
"dune-istl"
|
"dune-istl"
|
||||||
|
|
||||||
# required dependencies
|
# required dependencies
|
||||||
"dune-common ${_require_dune_common};
|
"dune-common REQUIRED;
|
||||||
SuperLU
|
SuperLU
|
||||||
"
|
"
|
||||||
# header to search for
|
# header to search for
|
||||||
|
@ -10,20 +10,13 @@
|
|||||||
# 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
|
||||||
|
|
||||||
# dune-common is only required if dune-localfunctions is; the "required-ness" is
|
|
||||||
# not transitive as far as CMake is concerned (i.e. if an optional package
|
|
||||||
# requests a package to be required, the build will fail if it's not found)
|
|
||||||
if (dune-localfunctions_FIND_REQUIRED)
|
|
||||||
set (_require_dune_common "REQUIRED")
|
|
||||||
endif (dune-localfunctions_FIND_REQUIRED)
|
|
||||||
|
|
||||||
include (OpmPackage)
|
include (OpmPackage)
|
||||||
find_opm_package (
|
find_opm_package (
|
||||||
# module name
|
# module name
|
||||||
"dune-localfunctions"
|
"dune-localfunctions"
|
||||||
|
|
||||||
# required dependencies
|
# required dependencies
|
||||||
"dune-common ${_require_dune_common}"
|
"dune-common REQUIRED"
|
||||||
# header to search for
|
# header to search for
|
||||||
"dune/localfunctions/common/localbasis.hh"
|
"dune/localfunctions/common/localbasis.hh"
|
||||||
|
|
||||||
|
@ -132,13 +132,15 @@ macro (find_and_append_package_to prefix name)
|
|||||||
# using config mode is better than using module (aka. find) mode
|
# using config mode is better than using module (aka. find) mode
|
||||||
# because then the package has already done all its probes and
|
# because then the package has already done all its probes and
|
||||||
# stored them in the config file for us
|
# stored them in the config file for us
|
||||||
if (${name}_DIR)
|
if (NOT ${NAME}_FOUND)
|
||||||
message (STATUS "Finding package ${name} using config mode")
|
if (${name}_DIR)
|
||||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
message (STATUS "Finding package ${name} using config mode")
|
||||||
else (${name}_DIR)
|
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||||
message (STATUS "Finding package ${name} using module mode")
|
else (${name}_DIR)
|
||||||
find_package (${name} ${ARGN})
|
message (STATUS "Finding package ${name} using module mode")
|
||||||
endif (${name}_DIR)
|
find_package (${name} ${ARGN})
|
||||||
|
endif (${name}_DIR)
|
||||||
|
endif (NOT ${NAME}_FOUND)
|
||||||
|
|
||||||
# the variable "NAME" may be replaced during find_package (as this is
|
# the variable "NAME" may be replaced during find_package (as this is
|
||||||
# now a macro, and not a function anymore), so we must reinitialize
|
# now a macro, and not a function anymore), so we must reinitialize
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
# ${module}_LIBRARIES Directory of shared object files
|
# ${module}_LIBRARIES Directory of shared object files
|
||||||
# ${module}_DEFINITIONS Defines that must be set to compile
|
# ${module}_DEFINITIONS Defines that must be set to compile
|
||||||
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
||||||
# ${module}_QUIET Verbosity of last find of this module
|
|
||||||
# HAVE_${MODULE} Binary value to use in config.h
|
# HAVE_${MODULE} Binary value to use in config.h
|
||||||
#
|
#
|
||||||
# Note: Arguments should be quoted, otherwise a list will spill into the
|
# Note: Arguments should be quoted, otherwise a list will spill into the
|
||||||
@ -52,17 +51,27 @@ macro (append_found src dst)
|
|||||||
endmacro (append_found src dst)
|
endmacro (append_found src dst)
|
||||||
|
|
||||||
macro (find_opm_package module deps header lib defs prog conf)
|
macro (find_opm_package module deps header lib defs prog conf)
|
||||||
# variables to pass on to other packages
|
# in addition to accepting mod-ule_ROOT, we also accept the somewhat
|
||||||
if (FIND_QUIETLY)
|
# more idiomatic MOD_ULE_ROOT variant
|
||||||
set (${module}_QUIET "QUIET")
|
string (TOUPPER "${module}" MODULE_UPPER)
|
||||||
else (FIND_QUIETLY)
|
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
|
||||||
set (${module}_QUIET "")
|
|
||||||
endif (FIND_QUIETLY)
|
|
||||||
|
|
||||||
# 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})
|
||||||
|
|
||||||
|
# variables to pass on to other packages
|
||||||
|
if (${module}_FIND_QUIETLY)
|
||||||
|
set (_${module}_quiet "QUIET")
|
||||||
|
else (${module}_FIND_QUIETLY)
|
||||||
|
set (_${module}_quiet "")
|
||||||
|
endif (${module}_FIND_QUIETLY)
|
||||||
|
if (${module}_FIND_REQUIRED)
|
||||||
|
set (_${module}_required "REQUIRED")
|
||||||
|
else (${module}_FIND_REQUIRED)
|
||||||
|
set (_${module}_required "")
|
||||||
|
endif (${module}_FIND_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
|
||||||
@ -73,11 +82,6 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
||||||
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
||||||
|
|
||||||
# in addition to accepting mod-ule_ROOT, we also accept the somewhat
|
|
||||||
# more idiomatic MOD_ULE_ROOT variant
|
|
||||||
string (TOUPPER ${module} MODULE_UPPER)
|
|
||||||
string (REPLACE "-" "_" MODULE ${MODULE_UPPER})
|
|
||||||
|
|
||||||
# if the user hasn't specified any location, and it isn't found
|
# if the user hasn't specified any location, and it isn't found
|
||||||
# in standard system locations either, then start to wander
|
# in standard system locations either, then start to wander
|
||||||
# about and look for it in proximity to ourself. Qt Creator likes
|
# about and look for it in proximity to ourself. Qt Creator likes
|
||||||
@ -196,24 +200,37 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
# list of necessities to build with the software
|
# list of necessities to build with the software
|
||||||
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
|
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
|
||||||
set (${module}_LIBRARIES "${${module}_LIBRARY}")
|
set (${module}_LIBRARIES "${${module}_LIBRARY}")
|
||||||
set (_deps)
|
# period because it should be something that evaluates to true
|
||||||
|
# in find_package_handle_standard_args
|
||||||
|
set (${module}_ALL_PREREQS ".")
|
||||||
foreach (_dep IN ITEMS ${deps})
|
foreach (_dep IN ITEMS ${deps})
|
||||||
separate_arguments (_args UNIX_COMMAND ${_dep})
|
separate_arguments (_${module}_args UNIX_COMMAND ${_dep})
|
||||||
if (_args)
|
if (_${module}_args)
|
||||||
find_and_append_package_to (${module} ${_args} ${${module}_QUIET})
|
# keep REQUIRED in the arguments only if we were required ourself
|
||||||
list (GET _args 0 _name_only)
|
# "required-ness" is not transitive as far as CMake is concerned
|
||||||
list (APPEND _deps ${_name_only})
|
# (i.e. if an optional package requests a package to be required,
|
||||||
else (_args)
|
# the build will fail if it's not found)
|
||||||
|
string (REPLACE "REQUIRED" "${_${module}_required}" _args_req "${_${module}_args}")
|
||||||
|
find_and_append_package_to (${module} ${_args_req} ${_${module}_quiet})
|
||||||
|
list (GET _${module}_args 0 _name_only)
|
||||||
|
string (TOUPPER "${_name_only}" _NAME_ONLY)
|
||||||
|
string (REPLACE "-" "_" _NAME_ONLY "${_NAME_ONLY}")
|
||||||
|
# check manually if it was found if REQUIRED; otherwise poison the
|
||||||
|
# dependency list which is checked later (so that it will fail)
|
||||||
|
if (("${_${module}_args}" MATCHES "REQUIRED") AND NOT ${_NAME_ONLY}_FOUND)
|
||||||
|
list (APPEND ${module}_ALL_PREREQS "${_name_only}-NOTFOUND")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
||||||
endif (_args)
|
endif ()
|
||||||
endforeach (_dep)
|
endforeach (_dep)
|
||||||
|
|
||||||
# since find_and_append_package_to is a macro, this variable have
|
# since find_and_append_package_to is a macro, this variable have
|
||||||
# probably been overwritten (due to its common name); it is now
|
# probably been overwritten (due to its common name); it is now
|
||||||
# this module's last dependency instead of the name of the module
|
# this module's last dependency instead of the name of the module
|
||||||
# itself, so it must be restored
|
# itself, so it must be restored
|
||||||
string (TOUPPER ${module} MODULE_UPPER)
|
string (TOUPPER "${module}" MODULE_UPPER)
|
||||||
string (REPLACE "-" "_" MODULE ${MODULE_UPPER})
|
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
|
||||||
|
|
||||||
# compile with this option to avoid avalanche of warnings
|
# compile with this option to avoid avalanche of warnings
|
||||||
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}")
|
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}")
|
||||||
@ -263,7 +280,7 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
# if the search is going to fail, then write these variables to
|
# if the search is going to fail, then write these variables to
|
||||||
# the console as well as a diagnostics
|
# the console as well as a diagnostics
|
||||||
if ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
if ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||||
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
|
AND (_${module}_required OR NOT _${module}_quiet))
|
||||||
if (DEFINED ${module}_DIR)
|
if (DEFINED ${module}_DIR)
|
||||||
message ("${module}_DIR = ${${module}_DIR}")
|
message ("${module}_DIR = ${${module}_DIR}")
|
||||||
elseif (DEFINED ${module}_ROOT)
|
elseif (DEFINED ${module}_ROOT)
|
||||||
@ -272,11 +289,11 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
message ("${MODULE}_ROOT = ${${MODULE}_ROOT}")
|
message ("${MODULE}_ROOT = ${${MODULE}_ROOT}")
|
||||||
endif (DEFINED ${module}_DIR)
|
endif (DEFINED ${module}_DIR)
|
||||||
endif ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
endif ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||||
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
|
AND (_${module}_required OR NOT _${module}_quiet))
|
||||||
find_package_handle_standard_args (
|
find_package_handle_standard_args (
|
||||||
${module}
|
${module}
|
||||||
DEFAULT_MSG
|
DEFAULT_MSG
|
||||||
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE}
|
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE} ${module}_ALL_PREREQS
|
||||||
)
|
)
|
||||||
|
|
||||||
# allow the user to override these from user interface
|
# allow the user to override these from user interface
|
||||||
@ -286,6 +303,7 @@ macro (find_opm_package module deps header lib defs prog conf)
|
|||||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||||
# that the module name should be in uppercase (?!)
|
# that the module name should be in uppercase (?!)
|
||||||
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
|
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||||
|
set (${MODULE}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||||
|
|
||||||
# print everything out if we're asked to
|
# print everything out if we're asked to
|
||||||
if (${module}_DEBUG)
|
if (${module}_DEBUG)
|
||||||
@ -301,7 +319,6 @@ function (debug_find_vars module)
|
|||||||
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
||||||
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
||||||
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
||||||
message (STATUS "${module}_QUIET = ${${module}_QUIET}")
|
|
||||||
string (TOUPPER ${module} MODULE)
|
string (TOUPPER ${module} MODULE)
|
||||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||||
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
||||||
|
@ -14,6 +14,6 @@ set (opm-material_DEPS
|
|||||||
# compile with C++0x/11 support if available
|
# compile with C++0x/11 support if available
|
||||||
"CXX11Features REQUIRED"
|
"CXX11Features REQUIRED"
|
||||||
# DUNE dependency
|
# DUNE dependency
|
||||||
"dune-common"
|
"dune-common REQUIRED"
|
||||||
"dune-istl"
|
"dune-istl REQUIRED"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user