Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tribits_invalid_value() function for else statements for enums #572

Open
bartlettroscoe opened this issue Mar 29, 2023 · 0 comments
Open

Comments

@bartlettroscoe
Copy link
Member

Description

There is a lot of code in TriBITS that passed strings as enums like:

if (<varName> STREQUAL "<valueA>")
  ...
elseif (<varName> STREQUAL "<valueB>")
  ...
elseif (<varName> STREQUAL "<valueC>")
  ...
else()
  message(FATAL_ERROR "Error, the value of <varName>='${<varName>}' is not in the allowed list ...")
endif()

It may help to replace this with a function like:

else()
  tribits_invalid_value(<varName> [<listOfValidValues>])
endif()

where the list of valid values var name <listOfValidValues> could be empty.

NOTE: Something like this was suggested by @KyleFromKitware in #560 (review).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ToDo
Development

No branches or pull requests

1 participant