How to run cmake with clion.jar

I make clion plugin to run valgrind, so I need run cmake(cmake --build path/to/out --target target_name) to build specific target, how to run it, I don't understand /home/roroco/Downloads/clion-1.2.2/lib/clion.jar!/com/jetbrains/cidr/cpp/cmake/CMakeRunner.class#runCMake parameters

public com.intellij.execution.process.ProcessOutput runCMake(@org.jetbrains.annotations.NotNull file, @org.jetbrains.annotations.NotNull file1, @org.jetbrains.annotations.NotNull java.util.List<java.lang.String> list, boolean b, @org.jetbrains.annotations.NotNull java.util.Map<java.lang.String,java.lang.String> map) throws com.jetbrains.cidr.cpp.cmake.CMakeException { /* compiled code */ }



How the user is supported to interact with the plugin, if it's using run configuration then you probably need another way to do it in code.

If you share some details on the workflow I'd be able to help you better.


see my, I hope control start "Messages Build" and force kill "Messages Build" how to do that?


To build the selected run configuration you can use the following snippet:

new CMakeTargetAction.Build() {


public void doBuild(@NotNull Project project) { super.doBuild(project);}

}.doBuild(<pass project here>)



what about force kill "Messages Build", when I 

ExecutionManager.getInstance(pj).contentManager.allDescriptors //in groovy

I the return list size is 0, I can't find CMake Build Descriptors, How to get its process and kill it?


Sorry, I don't understand what you are trying to achieve.

Maybe you could describe your idea?


I use following code to run build

ProgramRunnerUtil.executeConfiguration(myPj, myConf,DefaultDebugExecutor.debugExecutorInstance)

If I run a build and I change code in this term and I run build again, the 2nd build doesn't run(see my screencast, so I need to force kill previous cmake build.


In the original post you wrote

>I make clion plugin to run valgrind, so I need run cmake

If you plan to use run configuration, please see documentation.

You'll probably need to extend CMakeAppRunConfiguration in order to get all 'build' and 'run' features for free.



"I make clion plugin to run valgrind, so I need run cmake", I think I fix it, "kill previous cmake build" is my extra problem.

I think extending CMakeAppRunConfiguration doesn't work since 


return list with size 0, that means, even I extending CMakeAppRunConfiguration, I have no way to get it, so is there other way?


another question: If I extend CMakeAppRunConfiguration, how to save build info(for instance, process pid) in whole clion running time?


Sorry, can't understand what you mean. Maybe step-by-step description of what you already have could help. Also, as I asked previously the general idea of the plugin might make things more clear


In action, I start debug session and I can get it's process pid, where to save process pid. I mean, as we know:


can get all RunContentDescriptor, where do these descriptors save, how should I do same thing?


If you run a CMake configuration it should be in the list of allDescriptors, and you can get ProcessHandler via com.intellij.execution.ExecutionManager#getRunningProcesses.


I'm very sure the descriptor is not exist(see my screencast > watch tool, the list size is 0) since in cmake build duration, the run configuration haven't run

My tmp solution is, when cmake build, I can find 

roroco   18367 15547  0 00:26 pts/4    00:00:00 /home/roroco/Downloads/clion-1.2.2/bin/cmake/bin/cmake --build /home/roroco/.clion12/system/plugins-sandbox/system/cmake/generated/aef44517/aef44517/Debug --target ro_vector_test -- -j 20

in process manager, so I can kill -s KILL it

again, please answer my question, how to persistently save java instance in action for other action use, for instance, save CMakeAppRunConfiguration instance and use it in another action


Please sign in to leave a comment.