summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-12-04 17:03:58 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-12-04 17:03:58 (GMT)
commita07808f816e1c6295a46cf897ce94ba8c718f9e1 (patch)
treee6f470a89108ada5f9ba64e239de57d13c4fcf74 /Source
parentde452f3fef9a6041fa5a4bee92a9ee88e95a40e7 (diff)
downloadCMake-a07808f816e1c6295a46cf897ce94ba8c718f9e1.zip
CMake-a07808f816e1c6295a46cf897ce94ba8c718f9e1.tar.gz
CMake-a07808f816e1c6295a46cf897ce94ba8c718f9e1.tar.bz2
crazy fix for putenv, and native path called on custom command paths
Diffstat (limited to 'Source')
-rw-r--r--Source/cmUnixMakefileGenerator.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 8aafc92..1e1487a 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -1084,7 +1084,14 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
for(cmSourceGroup::Commands::const_iterator c = commands.begin();
c != commands.end(); ++c)
{
- std::string command = c->first;
+ // escape spaces and convert to native slashes path for
+ // the command
+ std::string command =
+ cmSystemTools::EscapeSpaces(c->second.m_Command.c_str());
+ command = this->ConvertToNativePath(command.c_str());
+ command += " ";
+ // now add the arguments
+ command += c->second.m_Arguments;
const cmSourceGroup::CommandFiles& commandFiles = c->second;
// if the command has no outputs, then it is a utility command
// with no outputs
@@ -1680,17 +1687,24 @@ void cmUnixMakefileGenerator::ComputeSystemInfo()
{
if (m_CacheOnly)
{
+ // see man putenv for explaination of this stupid code....
+ static char envCXX[5000];
+ static char envCC[5000];
if(m_Makefile->GetDefinition("CMAKE_CXX_COMPILER"))
{
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
m_Makefile->ExpandVariablesInString(env);
- putenv(const_cast<char*>(env.c_str()));
+ strncpy(envCXX, env.c_str(), 4999);
+ envCXX[4999] = 0;
+ putenv(envCXX);
}
if(m_Makefile->GetDefinition("CMAKE_C_COMPILER"))
{
std::string env = "CC=${CMAKE_C_COMPILER}";
m_Makefile->ExpandVariablesInString(env);
- putenv(const_cast<char*>(env.c_str()));
+ strncpy(envCC, env.c_str(), 4999);
+ envCC[4999] = 0;
+ putenv(envCC);
}
// currently we run configure shell script here to determine the info
std::string output;