Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conditionally add install target #686

Merged
merged 2 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cms-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export interface CodeModelProject {
sourceDirectory: string;
buildDirectory: string;
targets: CodeModelTarget[];
hasInstallRule?: boolean;
}

export interface CodeModelConfiguration {
Expand Down
22 changes: 16 additions & 6 deletions src/cms-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ export class CMakeServerClientDriver extends CMakeDriver {
log.error('Found no matching code model for the current build type. This shouldn\'t be possible');
return [];
}
const metaTargets = [{
type: 'rich' as 'rich',
name: this.allTargetName,
filepath: 'A special target to build all available targets',
targetType: 'META',
}];
if(build_config.projects.some(project => (project.hasInstallRule)? project.hasInstallRule: false))
{
metaTargets.push({
type: 'rich' as 'rich',
name: 'install',
filepath: 'A special target to install all available targets',
targetType: 'META',
});
}
return build_config.projects.reduce<RichTarget[]>((acc, project) => acc.concat(project.targets.map(
t => ({
type: 'rich' as 'rich',
Expand All @@ -168,12 +183,7 @@ export class CMakeServerClientDriver extends CMakeDriver {
: 'Utility target',
targetType: t.type,
}))),
[{
type: 'rich' as 'rich',
name: this.allTargetName,
filepath: 'A special target to build all available targets',
targetType: 'META',
}]);
metaTargets);
}

get executableTargets(): ExecutableTarget[] {
Expand Down