cmake: Use if(... IN_LIST ...)
command
Available in CMake 3.3+.
This commit is contained in:
parent
2445808c02
commit
6a58b483ef
@ -1,11 +1,9 @@
|
|||||||
function(check_string_option_value option)
|
function(check_string_option_value option)
|
||||||
get_property(expected_values CACHE ${option} PROPERTY STRINGS)
|
get_property(expected_values CACHE ${option} PROPERTY STRINGS)
|
||||||
if(expected_values)
|
if(expected_values)
|
||||||
foreach(value IN LISTS expected_values)
|
if(${option} IN_LIST expected_values)
|
||||||
if(value STREQUAL "${${option}}")
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
|
||||||
message(FATAL_ERROR "${option} value is \"${${option}}\", but must be one of ${expected_values}.")
|
message(FATAL_ERROR "${option} value is \"${${option}}\", but must be one of ${expected_values}.")
|
||||||
endif()
|
endif()
|
||||||
message(AUTHOR_WARNING "The STRINGS property must be set before invoking `check_string_option_value' function.")
|
message(AUTHOR_WARNING "The STRINGS property must be set before invoking `check_string_option_value' function.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user