cmake string(ERROR_VARIABLE) examples

spglib/spglib cmake/DynamicVersion.cmake :277

string(JSON ${ARGS_OUTPUT_SHORT_HASH} ERROR_VARIABLE _ GET ${data} short-hash)

spglib/spglib cmake/DynamicVersion.cmake :278

string(JSON ${ARGS_OUTPUT_DISTANCE} ERROR_VARIABLE _ GET ${data} distance)

spglib/spglib cmake/DynamicVersion.cmake :280

string(JSON ${ARGS_OUTPUT_COMMIT} ERROR_VARIABLE _ GET ${data} commit)

spglib/spglib cmake/DynamicVersion.cmake :281

string(JSON ${ARGS_OUTPUT_DESCRIBE} ERROR_VARIABLE _ GET ${data} describe)

microsoft/vcpkg ports/skia/skia-functions.cmake :199

string(JSON array ERROR_VARIABLE error GET "${json}" ${ARGN})

microsoft/vcpkg ports/skia/skia-functions.cmake :201

string(JSON len ERROR_VARIABLE error LENGTH "${array}")

microsoft/vcpkg ports/skia/skia-functions.cmake :373

string(JSON sources ERROR_VARIABLE unused GET "${desc}" "${gn_target}" "sources")

microsoft/vcpkg scripts/cmake/vcpkg_from_github.cmake :69

string(JSON head_version
    ERROR_VARIABLE head_version_err
    GET "${version_contents}"
    "object"
    "sha"
)

microsoft/vcpkg scripts/cmake/z_vcpkg_fixup_rpath_macho.cmake :167

            string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" get_rpath_ov "${get_rpath_ov}")
            string(REGEX MATCHALL "rpath [^\n]+" get_rpath_ov "${get_rpath_ov}")
            string(REGEX REPLACE "rpath " "" rpath_list "${get_rpath_ov}")

            list(FIND rpath_list "${new_rpath}" has_new_rpath)
            if(NOT has_new_rpath EQUAL -1)
                list(REMOVE_AT rpath_list ${has_new_rpath})
                set(rpath_args)
            else()
                set(rpath_args -add_rpath "${new_rpath}")
            endif()
            foreach(rpath IN LISTS rpath_list)
                list(APPEND rpath_args "-delete_rpath" "${rpath}")
            endforeach()
            if(NOT rpath_args)
                continue()
            endif()

            # Set the new rpath
            execute_process(
                COMMAND "${install_name_tool_cmd}" ${rpath_args} "${macho_file}"
                OUTPUT_QUIET
                ERROR_VARIABLE set_rpath_error
                RESULT_VARIABLE set_rpath_exit_code
            )

            if(NOT "${set_rpath_error}" STREQUAL "" AND NOT set_rpath_exit_code EQUAL 0)
                message(WARNING "Couldn't adjust RPATH of '${macho_file}': ${set_rpath_error}")
                continue()
            endif()

            message(STATUS "Adjusted RPATH of '${macho_file}' to '${new_rpath}'")
        endforeach()
    endforeach()

    # Check for dependent libraries in executables and shared libraries that
    # need adjusting after id change
    list(LENGTH adjusted_shared_lib_old_ids last_adjusted_index)
    if(NOT last_adjusted_index EQUAL 0)
        math(EXPR last_adjusted_index "${last_adjusted_index} - 1")
        foreach(macho_file IN LISTS macho_executables_and_shared_libs)
            execute_process(
                COMMAND "${otool_cmd}" -L "${macho_file}"
                OUTPUT_VARIABLE get_deps_ov
                RESULT_VARIABLE get_deps_rv
            )
            if(NOT get_deps_rv EQUAL 0)
                message(FATAL_ERROR "Could not obtain dependencies list from '${macho_file}'")
            endif()
            # change adjusted_shared_lib_old_ids[i] -> adjusted_shared_lib_new_ids[i]
            foreach(i RANGE ${last_adjusted_index})
                list(GET adjusted_shared_lib_old_ids ${i} adjusted_old_id)
                z_vcpkg_regex_escape(
                    STRING "${adjusted_old_id}"
                    OUT_REGEX_ESCAPED_STRING_VAR regex
                )
                if(NOT get_deps_ov MATCHES "[ \t]${regex} ")
                    continue()
                endif()
                list(GET adjusted_shared_lib_new_ids ${i} adjusted_new_id)

                # Replace the old id with the new id
                execute_process(
                    COMMAND "${install_name_tool_cmd}" -change "${adjusted_old_id}" "${adjusted_new_id}" "${macho_file}"
                    OUTPUT_QUIET
                    ERROR_VARIABLE change_id_error
                    RESULT_VARIABLE change_id_exit_code
                )
                if(NOT "${change_id_error}" STREQUAL "" AND NOT change_id_exit_code EQUAL 0)
                    message(WARNING "Couldn't adjust dependent shared library install name in '${macho_file}': ${change_id_error}")
                    continue()
                endif()
                message(STATUS "Adjusted dependent shared library install name in '${macho_file}' (From '${adjusted_old_id}' -> To '${adjusted_new_id}')")
            endforeach()
        endforeach()
    endif()
endfunction()

microsoft/vcpkg scripts/detect_compiler/CMakeLists.txt :26

string(JSON COMPILER_EXISTS ERROR_VARIABLE JSON_ERROR GET "${JSON_CONTENT}" "${compiler_path}")

microsoft/vcpkg scripts/test_ports/cmake-user/portfile.cmake :77

string(JSON since ERROR_VARIABLE since_not_found GET "${packages_json}" "${i}" "\$since")