File: RedefaultableOption.cmake

package info (click to toggle)
btas 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,132 kB
  • sloc: cpp: 26,486; ansic: 1,545; makefile: 5
file content (12 lines) | stat: -rw-r--r-- 386 bytes parent folder | download | duplicates (2)
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()