File: UseDuneVer.cmake

package info (click to toggle)
opm-common 2022.10%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,468 kB
  • sloc: cpp: 164,554; python: 2,872; sh: 216; xml: 174; ansic: 149; pascal: 136; makefile: 12
file content (32 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# - 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)
  # CMake's find_package will set <package>_VERSION_(MAJOR|MINOR|REVISION)
  # we simply rely on that.
  # generate variable for what we have found
  string (TOUPPER "${suite}" _SUITE)
  string (TOUPPER "${module}" _MODULE)
  string (REPLACE "-" "_" _MODULE "${_MODULE}")
  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)

  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()
endfunction (find_dune_version suite module)