[CMake] Bug? CMP0008 and inability to use .a libraries with MSVC

Braddock Gaskill braddock at braddock.com
Thu Mar 12 09:41:11 EDT 2009


I am unable to use static GnuWin32 libraries using the lib*.a naming
convention with an MSVC 8 2005 target.

FIND_LIBRARY will find my libraries, but CMake 2.6-2 insists on
rewriting libraries ending with ".a" to ".a.lib" when the IDE Project
files are generated, and issues warning CMP0008 about linking to an item
"which is a full-path but not a valid library file name".

The warning is suppressed, but the library filenames are still
rewritten, even if I set the CMP0008 policy to "OLD".

For some reason this error does not effect an nmake target, only Visual
Studio.

I have to manually fix the library names in Visual Studio.

Below is a minimal CMakeLists.txt file which replicates the problem:

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
SET(CMAKE_LIBRARY_PATH 
   "C:/Program Files/GnuWin32/lib"
   ${CMAKE_LIBRARY_PATH})

SET(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "lib" "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} ".a" ".lib")
FIND_LIBRARY(ZLIB_LIBRARIES NAMES "z") 
ADD_EXECUTABLE(usez usez.c)
TARGET_LINK_LIBRARIES(usez ${ZLIB_LIBRARIES})

Is there a work-around?

Thanks,
Braddock Gaskill



More information about the CMake mailing list