2015-03-06 11:42:01 +01:00
# - Find version of a DUNE package
#
# Synopsis:
#
# find_dune_version (suite module)
#
# where:
# suite Name of the suite; this should always be "dune"
# module Name of the module, e.g. "common"
#
# Finds the content of DUNE_${MODULE}_VERSION_{MAJOR,MINOR,REVISION}
# from the installation.
#
# Add these variables to ${project}_CONFIG_IMPL_VARS in CMakeLists.txt
# if you need these in the code.
function ( find_dune_version suite module )
2017-10-10 10:07:30 +02:00
# CMake's find_package will set <package>_VERSION_(MAJOR|MINOR|REVISION)
# we simply rely on that.
2015-03-06 11:42:01 +01:00
# generate variable for what we have found
string ( TOUPPER "${suite}" _SUITE )
string ( TOUPPER "${module}" _MODULE )
string ( REPLACE "-" "_" _MODULE "${_MODULE}" )
2017-10-10 10:07:30 +02:00
set ( ${ _SUITE } _ ${ _MODULE } _VERSION_MAJOR "${${suite}-${module}_VERSION_MAJOR}" PARENT_SCOPE )
set ( ${ _SUITE } _ ${ _MODULE } _VERSION_MINOR "${${suite}-${module}_VERSION_MINOR}" PARENT_SCOPE )
set ( ${ _SUITE } _ ${ _MODULE } _VERSION_REVISION "${${suite}-${module}_VERSION_PATCH}" PARENT_SCOPE )
2015-03-06 11:42:01 +01:00
2017-10-20 12:37:34 +02:00
if ( ${ suite } - ${ module } _FOUND )
# print the version number we detected in the configuration log
message ( STATUS "Version ${${suite}-${module}_VERSION_MAJOR}.${${suite}-${module}_VERSION_MINOR}.${${suite}-${module}_VERSION_PATCH} of ${suite}-${module} from ${${suite}-${module}_DIR}" )
endif ( )
2015-03-06 11:42:01 +01:00
endfunction ( find_dune_version suite module )