Skip to content

Commit

Permalink
cmake: Use if(... IN_LIST ...) command
Browse files Browse the repository at this point in the history
Available in CMake 3.3+.
  • Loading branch information
hebasto committed Apr 20, 2023
1 parent 2445808 commit 6a58b48
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmake/CheckStringOptionValue.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
function(check_string_option_value option)
get_property(expected_values CACHE ${option} PROPERTY STRINGS)
if(expected_values)
foreach(value IN LISTS expected_values)
if(value STREQUAL "${${option}}")
return()
endif()
endforeach()
if(${option} IN_LIST expected_values)
return()
endif()
message(FATAL_ERROR "${option} value is \"${${option}}\", but must be one of ${expected_values}.")
endif()
message(AUTHOR_WARNING "The STRINGS property must be set before invoking `check_string_option_value' function.")
Expand Down

0 comments on commit 6a58b48

Please sign in to comment.