ENH: Add support for install postfix

This commit is contained in:
Andy Cedilnik 2004-02-03 10:53:41 -05:00
parent a721b96407
commit 038abb867e
3 changed files with 28 additions and 1 deletions

View File

@ -238,10 +238,18 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
std::string destination = "";
std::string stype = "FILES";
const char* build_type = m_Makefile->GetDefinition("BUILD_TYPE");
const char* debug_postfix = m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
std::string extra_dir = "";
int debug = 0;
if ( build_type )
{
extra_dir = build_type;
std::string btype = build_type;
cmSystemTools::LowerCase(btype);
if ( btype == "debug" )
{
debug = 1;
}
}
@ -341,17 +349,24 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
{
std::string destfile = destination + "/" + cmSystemTools::GetFilenameName(files[i]);
std::string ctarget = files[i].c_str();
std::string fname = cmSystemTools::GetFilenameName(ctarget);
std::string ext = cmSystemTools::GetFilenameExtension(ctarget);
std::string fnamewe = cmSystemTools::GetFilenameWithoutExtension(ctarget);
switch( itype )
{
case cmTarget::MODULE_LIBRARY:
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
if ( debug )
{
fname = fnamewe + debug_postfix + "." + ext;
}
case cmTarget::EXECUTABLE:
if ( extra_dir.size() > 0 )
{
cmOStringStream str;
str << cmSystemTools::GetFilenamePath(ctarget) << "/" << extra_dir << "/"
<< cmSystemTools::GetFilenameName(ctarget);
<< fname;
ctarget = str.str();
}
break;

View File

@ -83,6 +83,13 @@ void cmLocalGenerator::GenerateInstallRules()
fout << "# Install script for directory: " << m_Makefile->GetCurrentDirectory()
<< std::endl << std::endl;
const char* cmakeDebugPosfix = m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
if ( cmakeDebugPosfix )
{
fout << "SET(CMAKE_DEBUG_POSTFIX \"" << cmakeDebugPosfix << "\")"
<< std::endl << std::endl;
}
std::string libOutPath = "";
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
{

View File

@ -47,6 +47,11 @@ public:
*/
virtual bool IsInherited() {return true;}
/**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/