[CMake] Multiple library configurations with the same output name

Eric Noulard eric.noulard at gmail.com
Fri Mar 4 08:33:34 EST 2011


2011/3/4 Alexey Livshits <livchits at web.de>:
>> 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.

I am not a Visual Studio user so I may be missing your point here
but why having foo_1 and foo_2 ending up in the same workspace is a problem?

As long as the lib/dll end up in separate dirs (using *_OUTPUT_DIRECTORY).

>> 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

Should work too.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list