Clion - Get Build Command
I am developing plugin for CLion and I need to get the build command the project. Which command do I need to use to get the build command like:
"/Applications/CLion 2017.3.app/Contents/bin/cmake/bin/cmake" --build /Users/kunlung/CLionProjects/untitled7/cmake-build-debug --target all -- -j 4
The followings are the code I am using before.
but it doesn't work after 2017.3
1: CMakeWorkspace.getEnvironmentFor() method is gone
2: CMakeSettings.getEffectiveBuildOptionsList() is gone.
Are there any new methods to replace them or any other better ways to get the command?
Thanks
===========================================================
RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration();
BuildAndRunConfigurations configurations = ((CMakeAppRunConfiguration)settings.getConfiguration()).getBuildAndRunConfigurations();
CMakeConfiguration buildConfiguration = configurations.buildConfiguration;
File generatedDir = buildConfiguration.getConfigurationGenerationDir();
CMakeEnvironment environment = CMakeWorkspace.getInstance(project).getEnvironmentFor(buildConfiguration);
CMakeRunner runner = new CMakeRunner(environment);
final GeneralCommandLine cmd = runner.buildCommandLine(generatedDir,
Arrays.asList("--build", generatedDir.getPath(), "--target", buildConfiguration.getTarget().getName()),
true,
false);
cmd.addParameter("--");
cmd.addParameters(CMakeWorkspace.getInstance(project).getSettings().getEffectiveBuildOptionsList());
===========================================================
Please sign in to leave a comment.
Please follow IJSDK-388