[CMake] MSYS static libraries under MSVC
gga
ggarra at advancedsl.com.ar
Sat Jun 16 13:55:39 EDT 2007
Brandon Van Every wrote:
>
> I guess this must be a problem with 3rd party libraries. I've never
> had this problem with libraries I built myself, either with the MinGW
> or the MSYS generators.
>
Maybe it is me. Whenever I compile libogg, libvorbis, etc. statically
or dynamically, the resulting static or import file remains named .a.
Maybe there's a way to fool autotools to create .lib files?
Interestingly enough, the ffmpeg libraries do build with a .lib suffix
when compiled dynamically and an .a suffix when statically.
> What are you passing exactly to TARGET_LINK_LIBRARIES?
>
TARGET_LINK_LIBRARIES( mrViewer ${LIBRARIES} )
where LIBRARIES contains a bunch of libraries found by FIND_LIBRARIES(),
or, since it does not find libraries named .a, with FIND_FILE().
When run under MSVC, all of these are defined like:
CMAKE_FIND_LIBRARY_SUFFIXES=".lib"
CMAKE_IMPORT_LIBRARY_SUFFIX=".lib"
CMAKE_STATIC_LIBRARY_SUFFIX=".lib"
CMAKE_SHARED_LIBRARY_SUFFIX=".dll"
CMAKE_SHARED_MODULE_SUFFIX=".dll"
so it makes perfect sense that cmake is trying to find libraries with a
.lib suffix only and then even if given a file called .a it will try to
add the .lib suffix before passing it as a command-line.
I may be able to force cmake to work like I want if I make
CMAKE_FIND_LIBRARY_SUFFIXES=".lib;.a" and
CMAKE_STATIC_LIBRARY_SUFFIX="", but then any library passed in should
always come with the .a or .lib suffix.
>> Is there any way to make this work? I cannot change the extension for
>> all libraries, as most other libraries will probably be named .lib under
>> msvc.
>
> Sounds like bugs.
Well, not really. It is not a bug. It is a lack of a feature.
Currently, static libraries can only be .lib.
--
Gonzalo Garramuño
ggarra at advancedsl.com.ar
AMD4400 - ASUS48N-E
GeForce7300GT
Kubuntu Edgy
More information about the CMake
mailing list