function addCppLinker(h)

%   Copyright 2014 The MathWorks, Inc.

[missing,uninitialized] = h.locateCppLinker();
if missing
    h.generateBuildTools( [  ], 'Build Tool', 'C++ Linker' );
    uninitialized = true;
end
if uninitialized
    % Get the values of the C Linker - use this to initialize the
    % missing or uninitialized C++ Linker.
    bt = h.getBuildTool( 'C Linker' );
    toolName = strrep( bt.Name, 'C Linker', 'C++ Linker' );
    if strcmp( bt.Name, toolName )
        toolName = strrep( toolName, 'Linker', 'C++ Linker' );
    end
    tool = h.getBuildTool( 'C++ Linker' );
    tool.setName( toolName );
    tool.setCommand( bt.getCommand() );
    tool.setPath( bt.getPath() );
    keys = bt.Directives.keys();
    values = cellfun( @(x) x.getValue(), bt.Directives.values, 'UniformOutput', false );
    for i = 1:numel( keys )
        if tool.Directives.isKey( keys{ i } )
            tool.setDirective( keys{ i }, values{ i } );
        end
    end
    keys = bt.FileExtensions.keys();
    values = cellfun( @(x) x.getValue(), bt.FileExtensions.values, 'UniformOutput', false );
    for i = 1:numel( keys )
        if tool.Directives.isKey( keys{ i } )
            tool.setDirective( keys{ i }, values{ i } );
        end
    end
end
end
