From 99a18eb63121c2149c53c9a0c1d3d67eab1f935d Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 5 Aug 2025 13:16:33 +0200 Subject: [PATCH] fix(cmakev2/utilities): respect CMake's regular variables in __get_default_value Currently, only the value stored in CMake's cache is considered when setting the default value. Allow regular variables as well, which may be set in the project's CMakeLists.txt file. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/utilities.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cmakev2/utilities.cmake b/tools/cmakev2/utilities.cmake index f82b5e78b93..e4e6014a0bc 100644 --- a/tools/cmakev2/utilities.cmake +++ b/tools/cmakev2/utilities.cmake @@ -178,7 +178,7 @@ endfunction() order of precedence, with the first having the highest precedence. 1. environmental variable - 2. CMake cache variable + 2. CMake variable or value stored in CMake's cache 3. ```` as specified with the ``DEFAULT`` option #]] function(__get_default_value) @@ -202,8 +202,8 @@ function(__get_default_value) if(DEFINED ENV{${ARG_VARIABLE}}) set(value "$ENV{${ARG_VARIABLE}}") - elseif(DEFINED CACHE{${ARG_VARIABLE}}) - set(value "$CACHE{${ARG_VARIABLE}}") + elseif(DEFINED ${ARG_VARIABLE}) + set(value "${${ARG_VARIABLE}}") else() set(value "${ARG_DEFAULT}") endif()