File: assert_value_in_set.cmake

package info (click to toggle)
cppad 2025.00.00.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,552 kB
  • sloc: cpp: 112,594; sh: 5,972; ansic: 179; python: 71; sed: 12; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 848 bytes parent folder | download
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
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
# assert_value_in_set(value element_1 ... element_n )
#
# value: (in)
# is the value we are searching for.
#
# element_j: (in)
# is the j-th element of the set.
#
MACRO(assert_value_in_set)
   SET(argv ${ARGV})
   LIST(GET argv 0 value)
   LIST(REMOVE_AT argv 0)
   SET(ok FALSE)
   FOREACH(entry ${argv} )
      IF( "${${value}}" STREQUAL "${entry}" )
         SET(ok TRUE)
      ENDIF( "${${value}}" STREQUAL "${entry}" )
   ENDFOREACH(entry ${argv} )
   IF(NOT ok)
      MESSAGE(FATAL_ERROR
         "${value} is not one of following: ${argv}"
      )
   ENDIF(NOT ok)
ENDMACRO(assert_value_in_set)