summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-01-27 17:37:30 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-01-27 17:37:30 (GMT)
commitd13e30f3ae02444682a2e593768020b9d11b6b54 (patch)
tree1bda720a9a8f0c993a5f6c848c9328c0e455d6ef /Source/cmFileCommand.cxx
parent127872e820ea7aed784c780d29f824817193c14e (diff)
downloadCMake-d13e30f3ae02444682a2e593768020b9d11b6b54.zip
CMake-d13e30f3ae02444682a2e593768020b9d11b6b54.tar.gz
CMake-d13e30f3ae02444682a2e593768020b9d11b6b54.tar.bz2
ENH: Make install on windows seems to work now
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx85
1 files changed, 63 insertions, 22 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index b6ddfcf..68170e0 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -237,6 +237,14 @@ 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");
+ std::string extra_dir = "";
+ if ( build_type )
+ {
+ extra_dir = build_type;
+ }
+
+
std::vector<std::string> files;
int itype = cmTarget::INSTALL_FILES;
@@ -245,6 +253,7 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
std::string expr;
bool in_files = false;
+ bool optional = false;
for ( ; i != args.size(); ++i )
{
const std::string* cstr = &args[i];
@@ -258,6 +267,11 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
{
i++;
stype = args[i];
+ if ( args[i+1] == "OPTIONAL" )
+ {
+ i++;
+ optional = true;
+ }
in_files = false;
}
else if ( *cstr == "FILES" && !in_files)
@@ -289,6 +303,10 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
{
itype = cmTarget::EXECUTABLE;
}
+ else if ( stype == "PROGRAM" )
+ {
+ itype = cmTarget::INSTALL_PROGRAMS;
+ }
else if ( stype == "STATIC_LIBRARY" )
{
itype = cmTarget::STATIC_LIBRARY;
@@ -302,12 +320,6 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
itype = cmTarget::MODULE_LIBRARY;
}
- for ( i = 0; i < files.size(); i ++ )
- {
- std::cout << " " << files[i];
- }
- std::cout << std::endl;
-
if ( !cmSystemTools::FileExists(destination.c_str()) )
{
if ( !cmSystemTools::MakeDirectory(destination.c_str()) )
@@ -329,33 +341,62 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
for ( i = 0; i < files.size(); i ++ )
{
std::string destfile = destination + "/" + cmSystemTools::GetFilenameName(files[i]);
-
- if ( !cmSystemTools::CopyFileAlways(files[i].c_str(), destination.c_str()) )
- {
- std::string errstring = "cannot copy file: " + files[i] +
- " to directory : " + destination + ".";
- this->SetError(errstring.c_str());
- return false;
- }
+ std::string ctarget = files[i].c_str();
switch( itype )
{
case cmTarget::MODULE_LIBRARY:
+ case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::EXECUTABLE:
+ if ( extra_dir.size() > 0 )
+ {
+ cmOStringStream str;
+ str << cmSystemTools::GetFilenamePath(ctarget) << "/" << extra_dir << "/"
+ << cmSystemTools::GetFilenameName(ctarget);
+ ctarget = str.str();
+ }
+ break;
+ }
+
+ if ( cmSystemTools::FileExists(ctarget.c_str()) )
+ {
+ if ( !cmSystemTools::CopyFileAlways(ctarget.c_str(), destination.c_str()) )
+ {
+ std::string errstring = "cannot copy file: " + ctarget +
+ " to directory : " + destination + ".";
+ this->SetError(errstring.c_str());
+ return false;
+ }
+ switch( itype )
+ {
+ case cmTarget::MODULE_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::EXECUTABLE:
+ case cmTarget::INSTALL_PROGRAMS:
- if ( !cmSystemTools::SetPermissions(destfile.c_str(),
+ if ( !cmSystemTools::SetPermissions(destfile.c_str(),
#if defined( _MSC_VER ) || defined( __MINGW32__ )
- S_IREAD | S_IWRITE | S_IEXEC
+ S_IREAD | S_IWRITE | S_IEXEC
#elif defined( __BORLANDC__ )
- S_IRUSR | S_IWUSR | S_IXUSR
+ S_IRUSR | S_IWUSR | S_IXUSR
#else
- S_IRUSR | S_IWUSR | S_IXUSR |
- S_IRGRP | S_IXGRP |
- S_IROTH | S_IXOTH
+ S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP |
+ S_IROTH | S_IXOTH
#endif
- ) )
+ ) )
+ {
+ perror("problem doing chmod.");
+ }
+ }
+ }
+ else
+ {
+ if ( !optional )
{
- perror("problem doing chmod.");
+ std::string errstring = "cannot find file: " + ctarget + " to install.";
+ this->SetError(errstring.c_str());
+ return false;
}
}
}