summaryrefslogtreecommitdiffstats
path: root/Source/cmTryRunCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-19 20:07:23 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-19 20:07:23 (GMT)
commit5d0716439fc07bfa5e8605efa3fc8be5c98217ed (patch)
treea99c0e0461a6d00323b5e3f62666b754db08030b /Source/cmTryRunCommand.cxx
parent4027cfbb2dc654f2501301fad1a36ceaef266f95 (diff)
downloadCMake-5d0716439fc07bfa5e8605efa3fc8be5c98217ed.zip
CMake-5d0716439fc07bfa5e8605efa3fc8be5c98217ed.tar.gz
CMake-5d0716439fc07bfa5e8605efa3fc8be5c98217ed.tar.bz2
Fix tryrun to work on Linux
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r--Source/cmTryRunCommand.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 84e8e3a..55fbfd1 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -57,14 +57,14 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
int res = cmTryCompileCommand::CoreTryCompileCode(m_Makefile, tryCompile, false);
// now try running the command if it compiled
- std::string binaryDirectory = argv[1] + "/CMakeTmp";
+ std::string binaryDirectory = argv[2] + "/CMakeTmp";
if (!res)
{
int retVal;
std::string output;
std::string command;
command = binaryDirectory;
- command += "/cmTryRunExec";
+ command += "/cmTryCompileExec";
command += cmSystemTools::GetExecutableExtension();
std::string fullPath;
if(cmSystemTools::FileExists(command.c_str()))
@@ -74,14 +74,19 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
else
{
command = binaryDirectory;
- command += "/Debug/cmTryRunExec";
+ command += "/Debug/cmTryCompileExec";
command += cmSystemTools::GetExecutableExtension();
if(cmSystemTools::FileExists(command.c_str()))
{
fullPath = cmSystemTools::CollapseFullPath(command.c_str());
}
+ else
+ {
+ cmSystemTools::Error("Unable to find executable for TRY_RUN",
+ command.c_str());
+ }
}
- if (runArgs.size() > 1)
+ if (fullPath.size() > 1)
{
std::string finalCommand = fullPath;
if(runArgs.size())
@@ -93,11 +98,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
// set the run var
char retChar[1000];
sprintf(retChar,"%i",retVal);
- m_Makefile->AddDefinition(argv[1].c_str(), retChar);
- }
- else
- {
- cmSystemTools::Error("Unable to find executable for TRY_RUN");
+ m_Makefile->AddDefinition(argv[0].c_str(), retChar);
}
}
@@ -116,6 +117,9 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
cmSystemTools::RemoveFile(fullPath.c_str());
}
}
+ std::string cacheFile = binaryDirectory;
+ cacheFile += "/CMakeLists.txt";
+ cmListFileCache::GetInstance()->FlushCache(cacheFile.c_str());
return true;
}