ENH: Patch from Toni Timonen to allow cross-compiling of DLLs.

This commit is contained in:
Brad King 2006-09-07 10:05:12 -04:00
parent 64231a20a2
commit d458764791
1 changed files with 43 additions and 35 deletions

View File

@ -367,6 +367,11 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false; return false;
} }
// Check whether this is a DLL platform.
bool dll_platform = (this->Makefile->IsOn("WIN32") ||
this->Makefile->IsOn("CYGWIN") ||
this->Makefile->IsOn("MINGW"));
// Compute destination paths. // Compute destination paths.
std::string archive_dest; std::string archive_dest;
std::string library_dest; std::string library_dest;
@ -389,46 +394,49 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// platforms. All windows platforms are DLL platforms // platforms. All windows platforms are DLL platforms
// including cygwin. Currently no other platform is a DLL // including cygwin. Currently no other platform is a DLL
// platform. // platform.
#if defined(_WIN32) || defined(__CYGWIN__) if(dll_platform)
// This is a DLL platform.
if(archive_destination)
{ {
// The import library uses the ARCHIVE properties. // This is a DLL platform.
this->Makefile->AddInstallGenerator( if(archive_destination)
new cmInstallTargetGenerator(target, archive_dest.c_str(), true, {
archive_permissions.c_str(), // The import library uses the ARCHIVE properties.
archive_configurations, this->Makefile->AddInstallGenerator(
archive_component.c_str())); new cmInstallTargetGenerator(target, archive_dest.c_str(), true,
} archive_permissions.c_str(),
if(runtime_destination) archive_configurations,
{ archive_component.c_str()));
// The DLL uses the RUNTIME properties. }
this->Makefile->AddInstallGenerator( if(runtime_destination)
new cmInstallTargetGenerator(target, runtime_dest.c_str(), false, {
runtime_permissions.c_str(), // The DLL uses the RUNTIME properties.
runtime_configurations, this->Makefile->AddInstallGenerator(
runtime_component.c_str())); new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
} runtime_permissions.c_str(),
#else runtime_configurations,
// This is a non-DLL platform. runtime_component.c_str()));
if(library_destination) }
{
// The shared library uses the LIBRARY properties.
this->Makefile->AddInstallGenerator(
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
library_permissions.c_str(),
library_configurations,
library_component.c_str()));
} }
else else
{ {
cmOStringStream e; // This is a non-DLL platform.
e << "TARGETS given no LIBRARY DESTINATION for shared library " if(library_destination)
"target \"" << target.GetName() << "\"."; {
this->SetError(e.str().c_str()); // The shared library uses the LIBRARY properties.
return false; this->Makefile->AddInstallGenerator(
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
library_permissions.c_str(),
library_configurations,
library_component.c_str()));
}
else
{
cmOStringStream e;
e << "TARGETS given no LIBRARY DESTINATION for shared library "
"target \"" << target.GetName() << "\".";
this->SetError(e.str().c_str());
return false;
}
} }
#endif
} }
break; break;
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY: