function str = getExeLinkerCommand(h,buildInfo,varargin)
%

%   Copyright 2014-2019 The MathWorks, Inc.

toolKey = 'Linker';
toolOptionKey = toolKey;  % option name is same as tool name
if h.ToolchainInfo.BuildTools.isKey('C++ Compiler')
    % Override the linker if a C++ source file or module is present
    exts = h.getAllModules;
    compilerTool_cpp = h.getBuildTool( 'C++ Compiler' );
    CPPSRC_EXTS = compilerTool_cpp.getIOFileExtensions( 'input' );

    if ispc
        % Perform a case insensitive comparison on PC
        exts = lower(exts);
        CPPSRC_EXTS = lower(CPPSRC_EXTS);
    end
    
    if any(ismember(exts, CPPSRC_EXTS))
        toolKey = { 'C++ Linker', toolKey };
        toolOptionKey = { 'C++ Linker', toolOptionKey };
    end
end
outputFlagKey = 'OutputFlag';
str = h.formCommandFromPattern( buildInfo, 'BuildTool', toolKey, toolOptionKey, outputFlagKey, varargin{ : } );
end
