[CMake] Multiple platforms/configurations

Michael Hertling mhertling at online.de
Tue Nov 8 18:47:27 EST 2011


On 11/08/2011 09:08 PM, Tom Deblauwe wrote:
> Hello,
> 
> I have 2 build configurations for the same source code and I am generating visual studio 2005 projects. So for the first configuration I need different defines than for the second configuration. So I do like this:
> 
> mkdir build1
> cd build1
> cmake -DPORT=bla ../source
> mkdir build2
> cd build2
> cmake -DPORT=foo ../source
> 
> This generates 2 visual studio 2005 solutions, one in build1 and one in build2. Now there are two project files and two solutions and each has one configuration. However I am porting existing code and the old habit was that the two build configurations were in the same .vcproj and .sln file so you could easily switch between the two configurations in visual studio. Are there any cmake ways to make this happen, so to have one project with all the configs?
> 
> Best regards,
> Tom,

What exactly do you do with that PORT variable in your CMakeLists.txt
file? Perhaps, you might simply map different values to configuration-
specific properties like COMPILE_DEFINITIONS_<CONFIG>. If you do more
complicated things based on the PORT variable's value, please provide
more information, at best a small but complete example, so we can see
whether there is a possibility to set up any comprehensive solution.

Regards,

Michael


More information about the CMake mailing list