Dependent projects

This started as a post about being able to set the build directory for CLion -- until I found that it isn't currently supported.  _Very_ frustrating to have this option in Preferences, but to have it do nothing (no message even), only to have to go to online support to find that it is known disabled.

Lets say I have two projects.  One, a 'library' another, an 'app'.  I'd like to be able to point the app at the built files for the library such that I can easily develop on both concurrently.

Since CLion places the built files in a random inaccessible directory, how should I accomplish this?

3 comments
Comment actions Permalink

Rob,

your case could be resolved by proper configuration of CMakeLists.txt file. Please, see our Quick CMake Tutorial  https://www.jetbrains.com/clion/help/quick-cmake-tutorial.html, sections Including sub-projects and Including libraries.  

0
Comment actions Permalink

Renat,

Thanks for the reply.

I'm quite experienced with CMake (outside CLion context).  Neither of the suggested approaches are appropriate for my case.  The sub-project approach suggests to use add_subdirectory - which I do often already, but is not appropriate for this case.  The library approach suggests I use find_package - which I do often already, but is not appropriate for this case.

The find_package case is almost appropriate -- the real problem is that I need find_package to be able to search in the build directory set up by CLion.  That way, I can point one project at a specific build of another project.  However, that gets quite ugly with CLion's build directory setup.

 

One of the great use cases of CMake's out of tree build is the ability to have multiple (many) builds from the same source.  On my dev machine, I frequently have separate builds for debug and release, different compilers and compiler versions, and even different configuration options to the build system.  I don't cross-compile, but that would be another great use case for multiple build directories.

CLion's hiding of the build directory seems to preclude this use case.

 

0
Comment actions Permalink

Rob,

I should suggest you to visit our FAQ page: https://intellij-support.jetbrains.com/hc/en-us/sections/201622805-CLion-FAQ .

There is an article there, where you could find an answer (question How to change a build directory in CLion?).

0

Please sign in to leave a comment.