Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkFunctionCheckMitkCompatibility.cmake
Go to the documentation of this file.
1 
2 # mitkFunctionCheckMitkCompatibility(VERSIONS [<version_name> <minimum_required_version>]... [REQUIRED])
3 #
4 # Example:
5 # mitkFunctionCheckMitkCompatibility(VERSIONS MITK_VERSION_PLUGIN_SYSTEM 1 REQUIRED)
6 #
8 
9  cmake_parse_arguments(_COMPAT "REQUIRED" "" "VERSIONS" ${ARGN})
10 
11  set(_is_version_name 1)
12  foreach(_item ${_COMPAT_VERSIONS})
13  if(_is_version_name)
14  set(_is_version_name 0)
15  set(_version_name ${_item})
16  if(NOT ${_version_name})
17  set(_msg_version_name_not_defined "Your MITK version is too old (${_version_name} not defined)")
18  if(_COMPAT_REQUIRED)
19  message(SEND_ERROR "${_msg_version_name_not_defined}")
20  else()
21  message(WARNING "${_msg_version_name_not_defined}")
22  endif()
23  endif()
24  else()
25  set(_is_version_name 1)
26  if(${_version_name})
27  set(_required_version ${_item})
28  if(${_version_name} VERSION_LESS ${_required_version})
29  set(_msg_version_mismatch "Your MITK version is too old, ${_version_name} version ${_required_version} or higher required, but only version ${${_version_name}} present.")
30  if(_COMPAT_REQUIRED)
31  message(SEND_ERROR "${_msg_version_mismatch}")
32  else()
33  message(WARNING "${_msg_version_mismatch}")
34  endif()
35  endif()
36  endif()
37  endif()
38  endforeach()
39 
40 endfunction()
mitkFunctionCheckMitkCompatibility()