ENH: add .def file support

This commit is contained in:
Bill Hoffman 2002-11-12 15:24:31 -05:00
parent cb42655060
commit e020a6d171
3 changed files with 17 additions and 5 deletions

View File

@ -3,7 +3,7 @@ SET(CMAKE_LINK_LIBRARY_FLAG "")
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)
@ -11,7 +11,7 @@ SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES> <LINK_FLAGS>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)

View File

@ -3,7 +3,7 @@ SET(CMAKE_LINK_LIBRARY_FLAG "")
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"link @<<\n /out:<TARGET> /dll <OBJECTS> <LINK_LIBRARIES> \n<<")
"link @<<\n /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> \n<<")
SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
@ -58,7 +58,7 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES nmake )
# executable linker flags
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
SET (CMAKE_EXE_LINKER_FLAGS_INIT "/nologo /STACK:10000000 /machine:I386 /INCREMENTAL:YES")
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept")

View File

@ -834,7 +834,19 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
linkFlags += this->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
#ifdef _WIN32
const std::vector<cmSourceFile*>& sources = t.GetSourceFiles();
for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
if((*i)->GetSourceExtension() == "def")
{
linkFlags += this->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += (*i)->GetFullPath();
linkFlags += " ";
}
}
#endif
this->OutputLibraryRule(fout, name, t,
this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX"),
this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"),