summaryrefslogtreecommitdiffstats
path: root/Source/cmSiteNameCommand.cxx
diff options
context:
space:
mode:
authorJim Miller <millerjv@crd.ge.com>2001-06-25 17:34:09 (GMT)
committerJim Miller <millerjv@crd.ge.com>2001-06-25 17:34:09 (GMT)
commitd2c2cf3296eaaa746134f20655be6770232c79c3 (patch)
treeb6d216ff76d6b68b12f068fb73c0dbb9e15b8198 /Source/cmSiteNameCommand.cxx
parentc40e8c501749043c0fe3b4e04a0c574a17ee94d5 (diff)
downloadCMake-d2c2cf3296eaaa746134f20655be6770232c79c3.zip
CMake-d2c2cf3296eaaa746134f20655be6770232c79c3.tar.gz
CMake-d2c2cf3296eaaa746134f20655be6770232c79c3.tar.bz2
FIX: added AddDefinition() to store site name and build name in makefile. Also stripped
white space from the result of hostname.
Diffstat (limited to 'Source/cmSiteNameCommand.cxx')
-rw-r--r--Source/cmSiteNameCommand.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 5ebc707..fe81cd7 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -69,9 +69,22 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string>& args)
std::string host;
cmSystemTools::RunCommand(hostname,
host);
+ if (host.length())
+ {
+ // remove any white space from the host name
+ std::string hostRegExp = "[ \t\n\r]*([^\t\n\r ]*)[ \t\n\r]*";
+ cmRegularExpression hostReg (hostRegExp.c_str());
+ if (hostReg.find(host.c_str()))
+ {
+ // strip whitespace
+ host = hostReg.match(1);
+ }
+ }
+
std::string siteName = host;
if(host.length())
{
+ // try to find the domain name for this computer
std::string nsCmd = nslookup;
nsCmd += " ";
nsCmd += host;
@@ -93,6 +106,8 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string>& args)
siteName.c_str(),
"Name of the computer/site where compile is being run",
cmCacheManager::STRING);
+
+ m_Makefile->AddDefinition("SITE", siteName.c_str());
return true;
}