fix up hostname for windows
This commit is contained in:
parent
303b77ad4c
commit
9b0a90fa9e
|
@ -47,9 +47,6 @@ IF(BUILD_TESTING)
|
||||||
# find a tcl shell command
|
# find a tcl shell command
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/FindTclsh.cmake)
|
INCLUDE(${CMAKE_ROOT}/Modules/FindTclsh.cmake)
|
||||||
|
|
||||||
FIND_PROGRAM(HOSTNAME hostname /usr/bsd /usr/sbin /usr/bin /bin /sbin)
|
|
||||||
FIND_PROGRAM(NSLOOKUP nslookup /usr/bin /usr/sbin /usr/local/bin)
|
|
||||||
|
|
||||||
# set the site name
|
# set the site name
|
||||||
SITE_NAME(SITE)
|
SITE_NAME(SITE)
|
||||||
# set the build name
|
# set the build name
|
||||||
|
@ -64,8 +61,6 @@ IF(BUILD_TESTING)
|
||||||
SITE
|
SITE
|
||||||
BUILDNAME
|
BUILDNAME
|
||||||
MAKECOMMAND
|
MAKECOMMAND
|
||||||
HOSTNAME
|
|
||||||
NSLOOKUP
|
|
||||||
JAVACOMMAND
|
JAVACOMMAND
|
||||||
PURIFYCOMMAND
|
PURIFYCOMMAND
|
||||||
GUNZIPCOMMAND
|
GUNZIPCOMMAND
|
||||||
|
|
|
@ -44,9 +44,17 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string siteName = "unknown";
|
std::string siteName = "unknown";
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
std::string host;
|
||||||
|
if(cmSystemTools::ReadRegistryValue(
|
||||||
|
"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\ComputerName\\ComputerName;ComputerName",
|
||||||
|
host))
|
||||||
|
{
|
||||||
|
siteName = host;
|
||||||
|
}
|
||||||
|
#else
|
||||||
// try to find the hostname for this computer
|
// try to find the hostname for this computer
|
||||||
if (hostname_cmd.length())
|
if (!cmSystemTools::IsOff(hostname_cmd.c_str()))
|
||||||
{
|
{
|
||||||
std::string host;
|
std::string host;
|
||||||
cmSystemTools::RunCommand(hostname_cmd.c_str(),
|
cmSystemTools::RunCommand(hostname_cmd.c_str(),
|
||||||
|
@ -80,7 +88,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to find the domain name for this computer
|
// try to find the domain name for this computer
|
||||||
if (nslookup_cmd.length())
|
if (!cmSystemTools::IsOff(nslookup_cmd.c_str()))
|
||||||
{
|
{
|
||||||
nslookup_cmd += " ";
|
nslookup_cmd += " ";
|
||||||
nslookup_cmd += host;
|
nslookup_cmd += host;
|
||||||
|
@ -104,7 +112,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
m_Makefile->
|
m_Makefile->
|
||||||
AddCacheDefinition(args[0].c_str(),
|
AddCacheDefinition(args[0].c_str(),
|
||||||
siteName.c_str(),
|
siteName.c_str(),
|
||||||
|
|
Loading…
Reference in New Issue