Gerhard Grimm wrote:
Hi Bill,

here's a minimal example, consisting of three files.

source.c:
---------------------------------------------
#include <stdio.h>

void MyExport1(void)
{
        puts("MyExport1");
}

void MyExport2(void)
{
        puts("MyExport2");
}
---------------------------------------------

source.def:
---------------------------------------------
EXPORTS
MyExport1
MyExport2
---------------------------------------------

CMakeLists.txt:
---------------------------------------------
project(MyProject)

add_library(MyLib SHARED source.c)

set_target_properties(MyLib PROPERTIES LINK_FLAGS 
"/DEF:${CMAKE_CURRENT_SOURCE_DIR}/source.def")
---------------------------------------------

When using the 2.4.7 Visual Studio .NET generator, the build will succeed, but the resulting 
"MyLib.dll" will not export any symbols, since the "/DEF:..." flag is missing 
in the project (reverting to 2.4.6 would fix this).
Using the NMake makefiles generator, the "/DEF:..." flag will be passed to the 
linker, and voilĂ  - we have exports.
OK, so I can reproduce the problem, and I will fix it. However, the reason you are alone here is that you are not really using cmake correctly. You can just add the .def as one of your sources and cmake knows what to do with it. As you stated before the /NOENTRY works. So, the following should be what you want. (The SHARED option will make sure that /DLL is used as a flag)

add_library(MyLib SHARED source.c source.def)
set_target_properties(MyLib PROPERTIES LINK_FLAGS "/NOENTRY")


-Bill



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

Reply via email to