function addLinkFlags(h, options, groups, params)
% ADDLINKFLAGS The addLinkFlags function adds specified linker options to the
% model's build information. Real-Time Workshop stores the linker options in a
% vector. The function adds options to the end of the vector based on the order
% in which you specify them.
%
% Argument    description
% buildinfo   Build information handle returned by RTW.Buildinfo.
%
% options     A character array or cell array of character arrays that
%             specifies the linker options to be added to the build
%             information. The function adds each option to the end of a linker
%             option vector. If you specify multiple options within a single
%             character array, for example '-MD -Gy', the function adds the
%             string to the vector as a single element.
%
% groups      (optional) A character array or cell array of character arrays
%             that groups specified Link Flags
%
% example 1:   
%   myModelBuildInfo = RTW.BuildInfo;
%   addLinkFlags(myModelBuildInfo, '-T','Temp');
%
% example 2:
%   myModelBuildInfo = RTW.BuildInfo;
%   addLinkFlags(myModelBuildInfo, '-MD -Gy','Debug');
%
% Please refer to the documentation for more information.
%

% Copyright 2005-2023 The MathWorks, Inc.

arguments
    h
    options
    groups = string.empty
    params.SharedLibraryMerge = true;
end

h.Options.addOptions('LinkFlags', options, groups, ...
    SharedLibraryMerge=params.SharedLibraryMerge);
