Hey Brandon...

   You will find the stuff in attachment.

Cheers,
Ronan.

Brandon Van Every wrote:
Please provide a reproducer script so others of us can test your claim.

Cheers,
Brandon Van Every

On Nov 6, 2007 6:04 PM, Ronan Collobert <[EMAIL PROTECTED]> wrote:
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.
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

extern foo();

int main()
{
  foo();
  return 0;
}

# Works perfectly under Cygwin,Linux,MacOSX
# Sux under Windows (cmake -G "NMake Makefiles" followed by nmake)
# If you comment these 3 lines, it works
# If after the generation of libfoo.lib you rename it in foo.lib and do nmake 
again, it works
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") # seems useless

# Shared library foo
ADD_LIBRARY(foo SHARED foo.c)

# Executable bar
ADD_EXECUTABLE(bar bar.c)
TARGET_LINK_LIBRARIES(bar foo)

#include <stdio.h>

#ifdef _WIN32
#define FOO_API __declspec(dllexport) 
#else
#define FOO_API
#endif

FOO_API void foo()
{
  printf("amazingly working\n");
}

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to