function customCodeSettings = get_custom_code_settings(targetId,parentTargetId)
    if(sf('get',targetId,'.useLocalCustomCodeSettings'))
      relevantTargetId = targetId;
    elseif(~sf('get',parentTargetId,'.applyToAllLibs'))
      relevantTargetId = targetId;
    else
      relevantTargetId = parentTargetId;
    end
    
    customCodeSettings.customCode = sf('get',relevantTargetId,'target.customCode');
    customCodeSettings.userIncludeDirs = sf('get',relevantTargetId,'target.userIncludeDirs');
    customCodeSettings.userSources = sf('get',relevantTargetId,'target.userSources');
    customCodeSettings.userLibraries = sf('get',relevantTargetId,'target.userLibraries');
    customCodeSettings.reservedNames = sf('get',relevantTargetId,'target.reservedNames');
    customCodeSettings.reservedNames = sf('get',relevantTargetId,'target.reservedNames');
    customCodeSettings.customInitializer = sf('get',relevantTargetId,'target.customInitializer');
    customCodeSettings.customTerminator = sf('get',relevantTargetId,'target.customTerminator');
    customCodeSettings.relevantTargetId = relevantTargetId;
    
    

    
    