Use existing CMake build?

I have plenty of projects set up with CMake, and most of them require quite some configuring (e.g. choosing the proper libs to link to, different toolchain, install paths, etc).
I would be very happy to try using CLion to develop them, but I do not want to set the CMake variables for each project again from scratch.

QtCreator has the very nice feature that it loads a project from the CMakeLists.txt, and then asks you to specify a build directory if it already exists.
Is there a way to do that with CLion, or are there plans to support that?

Thanks,
Carsten

0
6 comments

Building is only a small part of the problem. To be able to correctly parse and analyze the sources CLion must have the same information as compiler.

You can probably make use of the "Cache" table in the CMake toolchain, it allows you to provide the required information by adjusting the cache variables.

0

Yes sure I can configure the project again. But I have a large hierarchy of projects and their dependencies that are configured via bash scripts etc, so I would not want to enter all of that manually again.

I am also aware that I can go into the new build location that CLion creates itself, and adjust the CMakeCache.txt, but what I was asking for is to make CLion use all the settings of an existing build, including the toolchain settings, include and link paths, set variables etc, and even better: not to create a new build on its own.

0

Oh, I see. No, we don't have such plans, and there are two reasons:

  1. CLion understands only results of a specific CMake generator. An already existing build directory most likely will be in a different format.
  2. CLion needs to have information about all build types (debug/release/etc), but a single existing directory contains information only about a single one.
0

Thanks for clarifying that! Too bad that this renders CLion unsuitable to my daily work, I would have loved to use a similar coding experience for C++ as with PyCharm...

Best,
Carsten

0

This is very pity.
With such limitations our developers will never even try CLion.


> CLion understands only results of a  specific CMake generator. An already existing build directory most  likely will be in a different format.
Why would it be in different format?
Even if you are going to distribute 'special' version of cmake, you can always force us to use this version to create our build directory.


> CLion needs to have information about  all build types (debug/release/etc), but a single existing directory  contains information only about a single one.
Why does CLion need it?
This does not make sense to me.
All our developers use only one build type. And we have lots of developers and lots of C++ projects.

0

But couldn't you at least check the specified build directory to see if it meets the requirements? I'm assuming it requires the Makefile generator, why would it likely be in a different format?

QtCreator does this very well, I've never had a problem pointing it to an existing build directory.

Without this capability, it makes it nearly impossible to use tools like catkin to manage large CMake projects (thus making it incompatible with ROS).

0

Please sign in to leave a comment.