[Insight-users] Creating a static library with cMake

Luis Ibanez luis.ibanez at kitware.com
Wed Nov 7 08:11:39 EST 2007


Hi Sebastian,


Yes, it is very easy to create a static library.

Simply write the following commands in the CMakeLists.txt
file of your project:



    ADD_LIBRARY( MyLibraryName STATIC
       sourcefile1.cxx
       sourcefile2.cxx
       sourcefile3.cxx
       )

    TARGET_LINK_LIBRARIES( MyLibraryName  ITKCommon )



The "STATIC" modifier is not really necessary, since it is
the default option anyways.

The TARGET_LINK_LIBRARIES command indicates to CMake that
your library depends on other libraries (e.g. ITKCommon)
and that when an executable links to your library, it should
also link to ITKCommon (or any other libraries that you add
in that command).


     Regards,



         Luis



----------------------------
Sebastian Baecke wrote:
> Hi,
> 
> I am a newcomer with ITK. I install and created successfully ITK for
> VC6. And I create my first project, which worked very well as
> standalone!
> Is it possible to make a static library from my project an how?
> 
> Thanks for any suggestions
> Sebastian
> 
> 


More information about the Insight-users mailing list