Iterative CMake configure

已回答

I'm used to using the CMake GUI to create an out of source build, iteratively assisting it to find packages I have built in perhaps non-standard places or have multiple versions of.

For Instance, I may have two versions of VTK on my machine. Running CMake Gui, it fails to find VTK. So, I put the path in the GUI and hit configure again. When all the red is gone in the GUI, I then hit the Generate Button to build a project or MakeFiles.

CLion seems to automatically read the CMakeLists.txt. But if something fails, I want to be able add a path to the cache, say VTK8.bin to point it to the one I want to use.

 

Is there an iterative CMake workflow possible, similar to running the CMake GUI app? Or does one have to edit the CmakeLists.txt file directly, rather than the Cache?

 

Thanks

Rick

 

1

Hello! You can edit CMakeLists.txt or pass settings using the CMake profile.

-1

I have a similar situation.  I'm trying to use CLion with a very large project.  The traditional workflow for this project is:  set some environment variables (usually by a helper batch/shell script), run cmake-gui or ccmake, configure, twiddle a few CMake variables, configure again, maybe another twiddle and configure, then generate.  Mine is also an out-of-source build.

When I try to use this project with CLion nothing seems to happen.  Using CLion's CMake profile settings doesn't seem like a feasible approach - there are LOTS of CMake variables that might need adjustment.

 

0

Hi Jim,

I found a way to do real out of source builds.

 

use CMake-GUI to generate a .bin folder at the same level

 

foosrc

foosrc.bin

 

 

if you Open the foosrc.bin folder with CLion, CLion sees that the source folder is ../foosrc and asks you if you want to use that for source. Say yes, and things work as expected.

 

 

0

Hi Rfrank,

Unfortunately that didn't work for me.  I got the same prompt from CLion, and it showed the source tree, but all of the source files were flagged by CLion as not being part of the project, and I didn't have any enabled build/run menu items.

This is a rather large project - about 250 CMake files, and thousands of source files.

Jim

 

0

Hm, I’m dealing with building VTK, PCL, and others which is very large and it did work for me. 

 

 

0

Hi Rfrank,

Interesting!  VTK is just a bit smaller than the project I'm working with.  I'll give VTK a try with CLion.

Jim

0

Before I build I add the cofigurations

releae

debug

relwithdebinfo

 

and set the output dir to

foosrc.bin/release

etc

 

 

 

0

请先登录再写评论。