27
27
import org .eclipse .core .runtime .Platform ;
28
28
29
29
/**
30
+ * A ICBuildConfigurationProvider specialized for CMake
31
+ *
32
+ * Extenders can provide their own specialised CMakeConfiguration by extending this class and {@link CMakeBuildConfiguration}.
33
+ * Extenders need to override at least {@link #getId()}, and the various createCMakeBuildConfiguration methods.
34
+ * See the example project <a href="https://github.com/eclipse-cdt/cdt/tree/main/cmake/org.eclipse.cdt.cmake.example">
35
+ * org.eclipse.cdt.cmake.example</a> for a full example.
36
+ *
30
37
* @since 1.6
31
38
*/
32
39
public class CMakeBuildConfigurationProvider implements ICBuildConfigurationProvider {
@@ -41,6 +48,30 @@ public String getId() {
41
48
return ID ;
42
49
}
43
50
51
+ /**
52
+ * Extenders should override this method to construct their specialized build configuration.
53
+ */
54
+ protected CMakeBuildConfiguration createCMakeBuildConfiguration (IBuildConfiguration config , String name )
55
+ throws CoreException {
56
+ return new CMakeBuildConfiguration (config , name );
57
+ }
58
+
59
+ /**
60
+ * Extenders should override this method to construct their specialized build configuration.
61
+ */
62
+ protected CMakeBuildConfiguration createCMakeBuildConfiguration (IBuildConfiguration config , String name ,
63
+ IToolChain toolChain ) {
64
+ return new CMakeBuildConfiguration (config , name , toolChain );
65
+ }
66
+
67
+ /**
68
+ * Extenders should override this method to construct their specialized build configuration.
69
+ */
70
+ protected CMakeBuildConfiguration createCMakeBuildConfiguration (IBuildConfiguration config , String name ,
71
+ IToolChain toolChain , ICMakeToolChainFile toolChainFile , String launchMode ) {
72
+ return new CMakeBuildConfiguration (config , name , toolChain , toolChainFile , launchMode );
73
+ }
74
+
44
75
@ Override
45
76
public synchronized ICBuildConfiguration getCBuildConfiguration (IBuildConfiguration config , String name )
46
77
throws CoreException {
@@ -66,13 +97,13 @@ public synchronized ICBuildConfiguration getCBuildConfiguration(IBuildConfigurat
66
97
}
67
98
68
99
if (toolChain != null ) {
69
- return new CMakeBuildConfiguration (config , name , toolChain );
100
+ return createCMakeBuildConfiguration (config , name , toolChain );
70
101
} else {
71
102
// No valid combinations
72
103
return null ;
73
104
}
74
105
}
75
- CMakeBuildConfiguration cmakeConfig = new CMakeBuildConfiguration (config , name );
106
+ CMakeBuildConfiguration cmakeConfig = createCMakeBuildConfiguration (config , name );
76
107
ICMakeToolChainFile tcFile = cmakeConfig .getToolChainFile ();
77
108
IToolChain toolChain = cmakeConfig .getToolChain ();
78
109
if (toolChain == null ) {
@@ -81,7 +112,7 @@ public synchronized ICBuildConfiguration getCBuildConfiguration(IBuildConfigurat
81
112
}
82
113
if (tcFile != null && !toolChain .equals (tcFile .getToolChain ())) {
83
114
// toolchain changed
84
- return new CMakeBuildConfiguration (config , name , tcFile .getToolChain (), tcFile ,
115
+ return createCMakeBuildConfiguration (config , name , tcFile .getToolChain (), tcFile ,
85
116
cmakeConfig .getLaunchMode ());
86
117
} else {
87
118
return cmakeConfig ;
@@ -136,7 +167,7 @@ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChai
136
167
config = configManager .createBuildConfiguration (this , project , name , monitor );
137
168
}
138
169
139
- CMakeBuildConfiguration cmakeConfig = new CMakeBuildConfiguration (config , name , toolChain , file , launchMode );
170
+ CMakeBuildConfiguration cmakeConfig = createCMakeBuildConfiguration (config , name , toolChain , file , launchMode );
140
171
configManager .addBuildConfiguration (config , cmakeConfig );
141
172
return cmakeConfig ;
142
173
}
0 commit comments