[CMake] How to build 2 targets from the same source, differing in -D_SWITCHES_ only

John Drescher drescherjm at gmail.com
Thu Aug 27 09:01:49 EDT 2009


On Thu, Aug 27, 2009 at 8:55 AM, Eike
Kroemer<eike-michael.kroemer at atlas-elektronik.com> wrote:
> Hi Marcel, Christian,
>
>> Am 08/27/2009 01:30 PM Marcel Loose wrote:
>> I think the only safe and reliable way to do this is create several
>> build directories, e.g. build/type_1 and build/type_2.
>> When running cmake in build/type_1, you should add -D_TYPE1_ to the
>> preprocessor flags; same for build/type_2.
> By 'build directories' you mean to duplicate the library sourcecodes?
>
Not the source just the output. You put your source in a single folder
and then create 1 build tree for each different type of build you
want. On windows I use this to build my projects with different
compilers and on top of that I use this to create separate 32 and 64
bit builds.

John


More information about the CMake mailing list