If your goal is to link an executable to MainLib.lib, and MainLib.lib only,
then please add all the sources directly to the add_library(MainLib STATIC
...) call.

That is the easiest, most logical way to accomplish that task.

If it's something else, then elaborate with more details. Perhaps somebody
else will chime in if they have another good suggestion...

CMake does not directly support "convenience libs" -- search the mailing
list archives. This subject has had much discussion over the years.

Add all the sources to one library if that's what you want.....


HTH,
David


On Wed, Sep 22, 2010 at 12:19 PM, Andrea Galeazzi <[email protected]> wrote:

> Citando Michael Wild <[email protected]>:
>
>
>
>> On 22. Sep, 2010, at 12:48 , Andrea Galeazzi wrote:
>>
>>  Hi everybody,
>>> I've got a static lib project in vc6 as follow
>>> lib1
>>> lib2
>>> ......
>>> libN
>>> MainLib
>>>
>>> The MainLib doesn't actually have any source but it depends form  all the
>>> other projects (lib1,.....,libN) so it builds a static lib  which contains
>>> all the ones.
>>> Now my problems is how to write a CMakeLists in order to reproduce  both
>>> the same build and the same structure of solution in VS 2010  as the
>>> original one.
>>> Does anybody have any ideas?
>>> Cheers
>>>
>>
>> Do you ever *need* lib1..libN except for assembling MainLib? If not,  just
>> drop them, they're useless.
>>
>> Michael
>>
>> --
>> There is always a well-known solution to every human problem --  neat,
>> plausible, and wrong.
>> H. L. Mencken
>>
>>
>>
> That's true but how can I then generate a vcprj for each lib? Now my
> filesystem is:
> MainLib
>    CMakeLists.txt
>    +lib1
>       CMakeLists.txt
>       source1_1
>       source1_2
>       ........
>    +lib2
>       CMakeLists.txt
>       source2_1
>       source2_2
>       ........
>     ..........
>     +libN
>       CMakeLists.txt
>       sourceN_1
>       sourceN_2
>       ........
>
> CMakeLists.txt in MainLib has:
> add_library(MainLib STATIC )
> add_subdirectory(lib1)
> ...........
> target_link_libraries (MainLib lib1)
>
> it produces a right vs solution but it dosen't produce the MainLib.lib
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to