[CMake] MSYS static libraries under MSVC

Brandon Van Every bvanevery at gmail.com
Sat Jun 16 17:01:19 EDT 2007


On 6/16/07, gga <ggarra at advancedsl.com.ar> wrote:
> Brandon Van Every wrote:
>
> > 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().

Try doing the FIND_FILE just to determine that the file exists.  But
don't pass it to TARGET_LINK_LIBRARIES, instead pass the rootname of
the library.  CMake will convert such names to -lrootname flags.  I do
this in the Chicken build, it works.   Usually I'm not trying to find
a library name, I'm usually checking for a header file or function
that indicates the availability of a library.

FIND_FILE(blah ...)
IF(blah)
 SET(MORE_LIBS ${MORE_LIBS} rootname)
ENDIF(blah)
TARGET_LINK_LIBRARIES(mrViewer ${MORE_LIBS})

> 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"

Are you
1) running under the MSYS generator?
2) redefining the compiler to MSVC?

Just double checking how you get the results above.  I would have
expected the suffixes to be a property of the generator, but maybe
CMake is smart about the compiler.


Cheers,
Brandon Van Every


More information about the CMake mailing list