diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-05 14:39:13 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-05 14:39:13 (GMT) |
commit | 290c509e119d1e3cc6efa3ee53ab80bfba9f524b (patch) | |
tree | e45cb5fc706efd52af4b195d7b0a16eab787d35c /Source/cmaketest.cxx | |
parent | 1182eba905b64f194da50543a248846ac8cfb0d7 (diff) | |
download | CMake-290c509e119d1e3cc6efa3ee53ab80bfba9f524b.zip CMake-290c509e119d1e3cc6efa3ee53ab80bfba9f524b.tar.gz CMake-290c509e119d1e3cc6efa3ee53ab80bfba9f524b.tar.bz2 |
ENH: make sure the test tests the right cmake, and not the cmake used to bootstrap this cmake
Diffstat (limited to 'Source/cmaketest.cxx')
-rw-r--r-- | Source/cmaketest.cxx | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx index 4f35bcf..83e4e38 100644 --- a/Source/cmaketest.cxx +++ b/Source/cmaketest.cxx @@ -24,9 +24,21 @@ #include "windows.h" #endif + +// Create a class to clean up all the registered generators in case of return +struct CleanUp +{ + ~CleanUp() + { + cmMakefileGenerator::UnRegisterGenerators(); + } +}; + + // this is a test driver program for cmake. int main (int argc, char **argv) { + CleanUp cleanup; if (argc < 4) { std::cerr << "Usage: " << argv[0] << " test-src-dir test-bin-dir test-executable\n"; @@ -69,20 +81,22 @@ int main (int argc, char **argv) cmSystemTools::ChangeDirectory(binaryDirectory); std::vector<std::string> args; + std::string intdir = "."; +#ifdef CMAKE_INTDIR + intdir = CMAKE_INTDIR; +#endif // make sure the same generator is used // use this program as the cmake to be run, it should not // be run that way but the cmake object requires a vailid path - std::string cmakeCommand = CMAKE_COMMAND; - if(cmakeCommand[0] == '\\' && cmakeCommand[1] == '\"') - { - cmakeCommand = cmakeCommand.substr(2, cmakeCommand.size()-4); - } - if(cmakeCommand[0] == '\"') - { - cmakeCommand = cmakeCommand.substr(1, cmakeCommand.size()-2); - } + std::string cmakeCommand = CMAKE_BINARY_DIR; + cmakeCommand += "/Source"; + cmakeCommand += "/"; + cmakeCommand += intdir; + cmakeCommand += "/cmake"; + cmakeCommand += cmSystemTools::GetExecutableExtension(); + std::cout << "*** " << cmakeCommand << "\n"; args.push_back(cmakeCommand.c_str()); args.push_back(sourceDirectory); std::string generator = "-G"; @@ -143,10 +157,6 @@ int main (int argc, char **argv) std::string lowerCaseCommand = makeCommand; cmSystemTools::LowerCase(lowerCaseCommand); std::string dartMakeCommand = DART_MAKECOMMAND; - std::string buildtype = "Debug"; -#ifdef CMAKE_INTDIR - buildtype = CMAKE_INTDIR; -#endif // if msdev is the make program then do the following // MSDEV 6.0 if(lowerCaseCommand.find("msdev") != std::string::npos) @@ -163,7 +173,7 @@ int main (int argc, char **argv) makeCommand += " "; makeCommand += projectName; makeCommand += ".dsw /MAKE \"ALL_BUILD - "; - makeCommand += buildtype + "\" /REBUILD"; + makeCommand += intdir + "\" /REBUILD"; } // MSDEV 7.0 .NET else if (lowerCaseCommand.find("devenv") != std::string::npos) @@ -177,7 +187,7 @@ int main (int argc, char **argv) makeCommand += " "; makeCommand += projectName; makeCommand += ".sln /rebuild "; - makeCommand += buildtype + " /project ALL_BUILD"; + makeCommand += intdir + " /project ALL_BUILD"; } // command line make program else @@ -224,7 +234,7 @@ int main (int argc, char **argv) fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); } // try the Debug extension - tryPath = buildtype + "/"; + tryPath = intdir + "/"; tryPath += cmSystemTools::GetFilenameName(executableName); if(cmSystemTools::FileExists(tryPath.c_str())) { @@ -245,7 +255,7 @@ int main (int argc, char **argv) } tryPath = executableDirectory; tryPath += "/"; - tryPath += buildtype + "/"; + tryPath += intdir + "/"; tryPath += executableName; tryPath += cmSystemTools::GetExecutableExtension(); if(cmSystemTools::FileExists(tryPath.c_str())) @@ -280,7 +290,6 @@ int main (int argc, char **argv) std::cout << output << "\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); - cmMakefileGenerator::UnRegisterGenerators(); if(ret) { cmSystemTools::Error("test executable ", fullPath.c_str(), |