[CMake] Generating shared libraries on Visual 8.0

Michael Jackson mike.jackson at bluequartz.net
Tue Sep 30 09:27:31 EDT 2008


This is what I use:

# Build shared libraries
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
SET (LIB_TYPE STATIC)
SET (MXA_BUILT_AS_DYNAMIC_LIB)
IF (BUILD_SHARED_LIBS)
   SET (LIB_TYPE SHARED)
   SET (MXA_BUILT_AS_DYNAMIC_LIB 1)
   IF (WIN32)
     ADD_DEFINITIONS("-DMXA_BUILT_AS_DYNAMIC_LIB")
   ENDIF (WIN32)
ENDIF (BUILD_SHARED_LIBS)

and it seems to work on all systems that I have tried it on (XP, OS X,  
Linux).

Mike

On Sep 30, 2008, at 3:44 AM, Werner Smekal wrote:

> Hi Julien,
>>
>> In our "Mastering CMake" book, it is said that if you do not  
>> specify anything in ADD_LIBRARY, then it uses the BUILD_SHARED_LIBS  
>> variable to determine if it should build static or shared  
>> libraries. Should we set this variable to SHARED/STATIC or to 1/0  
>> as it is recommended in cmake 2.6 online documentation ? Maybe we  
>> did misread the book as we are setting BUILD_SHARED_LIBS to SHARED  
>> or STATIC. The strange thing is that it is working fine on linux- 
>> like OS ...
>
> BUILD_SHARED_LIBS should be set to ON/OFF (maybe also 0/1), e.g.  
> cmake -DBUILD_SHARED_LIBS=ON pathtosrc. Funny that it works in Linux  
> though ....
>
> Regards,
> Werner
>
> --
> Dr. Werner Smekal
> Institut fuer Allgemeine Physik
> Technische Universitaet Wien
> Wiedner Hauptstr 8-10
> A-1040 Wien
> Austria
>
> email: smekal at iap.tuwien.ac.at
> web: http://www.iap.tuwien.ac.at/~smekal
> phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469  
> (laboratory)
> fax: +43-(0)1-58801-13499
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list