Run Shell Script in Docker Container

Answered

Hi,

 

 I am new to CLion and new to development within Docker, so I apologise in case I am asking something too obvious ... :)

 

My use case is an existing code base which is:

- a docker container with all the required tools

- a cmake-based build system

- a shell script that prepares quite some stuff and runs cmake for several different configurations

 

CLion runs on a Windows host and uses Docker Desktop to connect to the Docker container.

 

My problem now is that I do not know how to configure CLion so that the run configuration uses the Docker container and then just runs the shell script.

 

In Build, Execution, Deployment -> Toolchains I have a Docker toolchain configured which runs fine (a Docker run config brings me in the container properly).

Then I created a Custom Build Target with my container and the scripts but that target is not built. When I try to build CLion always complains that it "Cannot find any CMake profile".

 

Can I tell CLion to ignore the CMakeLists.txt file? I suspect it finds that and configures itself for a CMake project, which ours is not in a pure sense.

 

Thanks for any help.

 

Cheers,

fschwa

 

0
3 comments

Hello!

>Can I tell CLion to ignore the CMakeLists.txt file?

You can unload the CMake project (Tools | CMake | Unload CMake Project), but in this case code insight features will stop working for this project.

Please take a look at the ability to initialize the toolchain environment via a script - https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#env-scripts. It might be useful for the "a shell script that prepares quite some stuff" part. As for the "runs cmake for several different configurations", I assume you need to create several CMake profiles for your configurations.

0

And feel free to comment or upvote https://youtrack.jetbrains.com/issue/CPP-8414 which covers your scenario, as far as I understand. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

Thanks for your hints. Currently we are right before a release but I will play around with this more soon. :)

0

Please sign in to leave a comment.