File: ecbuild_compat.cmake

package info (click to toggle)
ecflow 5.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,220 kB
  • sloc: cpp: 273,994; python: 22,754; sh: 3,643; perl: 774; xml: 333; f90: 204; ansic: 141; makefile: 63
file content (63 lines) | stat: -rw-r--r-- 2,339 bytes parent folder | download | duplicates (15)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# (C) Copyright 2019- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

####################################################################################################
# include our cmake macros, but only do so if this is the top project
if(ECBUILD_2_COMPAT AND NOT ECBUILD_SYSTEM_INITIALISED )
  if(ECBUILD_2_COMPAT_DEPRECATE)
    ecbuild_deprecate("The ecbuild 2 compatibility layer is deprecated. "
      "Please upgrade the build system and unset `ECBUILD_2_COMPAT`.")
  endif()

  function( __ecbuild_deprecated_watcher VAR ACCESS)
    if( ACCESS STREQUAL "READ_ACCESS" AND NOT DISABLE_ECBUILD_DEPRECATION_WARNINGS )
      message(DEPRECATION "The Variable '${VAR}' is deprecated! Please use '${ECBUILD_${VAR}_REPLACEMENT}' instead.")
    endif()
  endfunction()

  function(ecbuild_mark_compat OLD_VAR NEW_VAR)
    if(ECBUILD_2_COMPAT_DEPRECATE)
      if(NOT OLD_VAR STREQUAL NEW_VAR)
        set(ECBUILD_${OLD_VAR}_REPLACEMENT "${NEW_VAR}" CACHE INTERNAL "${OLD_VAR} is deprecated and was replaced by ${NEW_VAR}" FORCE)
        variable_watch(${OLD_VAR} __ecbuild_deprecated_watcher)
      endif()
    endif()
  endfunction()

  # use macro to acces value of NEW_VAR
  macro(ecbuild_declare_compat OLD_VAR NEW_VAR)
    cmake_parse_arguments(_p "PARENT_SCOPE" "" "" ${ARGN})

    if(_p_UNPARSED_ARGUMENTS)
      ecbuild_critical("Unknown keywords given to ecbuild_declare_compat(): \"${_p_UNPARSED_ARGUMENTS}\"")
    endif()

    if(ECBUILD_2_COMPAT_DEPRECATE)
      ecbuild_mark_compat(${OLD_VAR} ${NEW_VAR})
    endif()
    if(_p_PARENT_SCOPE)
      set(${OLD_VAR} ${${NEW_VAR}} PARENT_SCOPE)
    else()
      set(${OLD_VAR} ${${NEW_VAR}})
    endif()
  endmacro()


  include(ecbuild_compat_require)
  include(ecbuild_compat_setversion)
  include(ecbuild_compat_tplconfig)

  include(ecbuild_add_cxx11_flags)
  include(ecbuild_add_extra_search_paths)
  include(ecbuild_list_extra_search_paths)
  include(ecbuild_generate_rpc)
  include(ecbuild_use_package)
  include(ecmwf_git)

  include(ecbuild_check_cxx11)
endif()