File: RedefaultableOption.cmake

package info (click to toggle)
libint2 2.7.2-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,792 kB
  • sloc: ansic: 842,934; cpp: 47,847; sh: 3,139; makefile: 1,017; f90: 676; perl: 482; python: 334
file content (12 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
# if local variable is defined, use its value as the default, otherwise use _default
# this is consistent with cmake 3.13 and later (see policy CMP0077)
macro(redefaultable_option _name _descr _default)

  if (DEFINED ${_name})
    set(${_name}_DEFAULT ${${_name}})
  else()
    set(${_name}_DEFAULT ${_default})
  endif()
  option(${_name} "${_descr}" ${${_name}_DEFAULT})

endmacro()