From 6a58b483efb96de32134611963c16f6bf7e94d51 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:08:12 +0100 Subject: [PATCH] cmake: Use `if(... IN_LIST ...)` command Available in CMake 3.3+. --- cmake/CheckStringOptionValue.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/CheckStringOptionValue.cmake b/cmake/CheckStringOptionValue.cmake index bc4d7b57..5a4d939b 100644 --- a/cmake/CheckStringOptionValue.cmake +++ b/cmake/CheckStringOptionValue.cmake @@ -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.")