[CMake] Linking with -l and -L flags

Moreland, Kenneth kmorel at sandia.gov
Thu Jan 12 18:35:47 EST 2006


I tried the -static flag.  The linker gave an error about not finding
-lcrt0.o.  Apparently the -static flag is forcing all the libraries to
be static and standard C libraries are not available as static.

-Ken

> -----Original Message-----
> From: cmake-bounces+kmorel=sandia.gov at cmake.org 
> [mailto:cmake-bounces+kmorel=sandia.gov at cmake.org] On Behalf 
> Of James Bigler
> Sent: Thursday, January 12, 2006 2:36 PM
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Linking with -l and -L flags
> 
> >> I'm not sure, but the problem seems to be that the linker 
> is favoring 
> >> shared object libraries over static libraries regardless 
> of the order 
> >> of the -L paths.  Thus, if I want to link in my static Tcl library 
> >> the linker never chooses it.
> 
> For our project we had to set BUILD_SHARED_LIBS to OFF or ON 
> depending on what we wanted.
> 
> SET(BUILD_SHARED_LIBS ON)
> 
> This will add different arguments to linker.  For gcc -shared 
> or -static will tell gcc to give preference to shared or 
> static libraries.
> 
> James
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 



More information about the CMake mailing list