[CMake] Multiple library configurations with the same output name

Alexey Livshits livchits at web.de
Fri Mar 4 08:07:51 EST 2011


> You can definition two different library target
> and use OUTPUT_NAME property to adjust the name
>
> add_library(foo1 ${foo_source})
> set_target_properties(foo1 PROPERTIES
>                                       OUTPUT_NAME foo)
>
> add_library(foo2 ${foo_source})
> set_target_properties(foo2 PROPERTIES
>                                       OUTPUT_NAME foo)
>
> You probably want to adjust COMPILE_FLAGS and/or LINK_FLAGS
> for each target as well.

That's what I already do. I also set different *_OUTPUT_DIRECTORY to
avoid collisions. The problem is, I cannot define different PROJECTs,
so foo_1 and foo_2 are in the same VS workspace.

> If you intend to build those librarie during the same build then
> you'll have to define those targets in separate directories
> (with shared source are shared).

So?

foo
|
|- foo_1
   |- CMakelists.txt
|- foo_2
   |- CMakelists.txt
|
|- foo.cpp

-- 
BG,
Alexey


More information about the CMake mailing list