[CMake] Code::Blocks generator setting in CMakeLists

Alexander Neundorf a.neundorf-work at gmx.net
Sun Jun 8 18:18:20 EDT 2008


On Friday 06 June 2008, Roy van Pelt wrote:
> Dear all,
>
> Is it possible to include the generator choice into the CMakeLists.txt?
>
> I know for windows the CMake tool allows to configure the development
> environment. But for Linux you have to configure it using a parameter
> for CMake. I would like to incorporate this in my CMakeList if possible.

With cmake 2.6 there is a GUI also for Linux ("cmake-gui") which also asks you 
which generator to use.

> For instance:
> cmake -G CodeBlocks - Unix Makefiles
> Replace by
> CMAKE_GENERATOR CodeBlocks - Unix Makefiles
>
> Or something similar?

No, this is not possible. Once cmake would have reached that command, the 
generator would be already created, so it would be too late.
I'm not quite sure, maybe you can check CMAKE_GENERATOR for the current 
generator and fail if it's not the one you want. But I wouldn't recommend 
this, it should be up to the user to decide which generator to use.

Alex


More information about the CMake mailing list