[CMake] Import libraries prefix bug under windows?

Ronan Collobert collober at nec-labs.com
Tue Nov 6 18:04:10 EST 2007


Hi,

   I have been using CMake for quite a while now under 
Linux/MacOSX/Cygwin for a large project.

Recently I have been trying to make it work under Windows, using the 
freely available to download Windows SDK. (cmake -G "NMake Makefiles")

I encountered a small problem, which might be a CMake bug. (I am using 
the latest cmake 2.4.7)

I ask CMake to produce a dll (let say foo.dll), and then I want to link 
this dll to produce an executable bar.exe.

I also changed the prefixes of the dll using:
  SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
  SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib")

So in fact, the dll generated is libfoo.dll (which is right). An import 
library is also generated (libfoo.lib) (which is still right).

But then when the makefile generated by CMake wants to link and produce 
bar.exe, the linker complains that it did not find "foo.lib". It seems 
it completely ignore the given prefix of the dll here.

Moving "libfoo.lib" to "foo.lib" and resuming the compilation works.
Not having a prefix also works.
So I would say it is a bug.

In fact, I am not sure at all of this CMAKE_IMPORT_LIBRARY_PREFIX: 
whatever I put there is ignored for the production of libfoo.lib (it is 
always libfoo.lib which is produced, according to what it is given by 
CMAKE_SHARED_LIBRARY_PREFIX)

Ronan.


More information about the CMake mailing list