From b56815a4e92dd976e9e17fa8ecb4061ecb72b6fe Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Tue, 17 Jul 2007 12:01:39 -0400 Subject: [PATCH] COMP: fix build on Windows, where GetCurrentDirecty() is redefined to GetCurrentDirectoryA() -correct return value for md5sum Alex --- Source/cmake.cxx | 5 ++++- Source/cmakemain.cxx | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e90311e96..49ce6523e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1063,6 +1063,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) else if (args[1] == "md5sum" && args.size() >= 3) { char md5out[32]; + int retval = 0; for (std::string::size_type cc = 2; cc < args.size(); cc ++) { const char *filename = args[cc].c_str(); @@ -1070,18 +1071,20 @@ int cmake::ExecuteCMakeCommand(std::vector& args) if(cmSystemTools::FileIsDirectory(filename)) { std::cerr << "Error: " << filename << " is a directory" << std::endl; + retval++; } else if(!cmSystemTools::ComputeFileMD5(filename, md5out)) { // To mimic md5sum behavior in a shell: std::cerr << filename << ": No such file or directory" << std::endl; + retval++; } else { std::cout << std::string(md5out,32) << " " << filename << std::endl; } } - return 1; + return retval; } // Command to change directory and run a program. diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a6cd1edfe..c089ed672 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -14,6 +14,13 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ +// include these first, otherwise there will be problems on Windows +// with GetCurrentDirectory() being redefined +#ifdef CMAKE_BUILD_WITH_CMAKE +#include "cmDynamicLoader.h" +#include "cmDocumentation.h" +#endif + #include "cmake.h" #include "cmCacheManager.h" #include "cmListFileCache.h" @@ -24,9 +31,6 @@ #include "cmMakefile.h" #ifdef CMAKE_BUILD_WITH_CMAKE -#include "cmDynamicLoader.h" -#include "cmDocumentation.h" - //---------------------------------------------------------------------------- static const cmDocumentationEntry cmDocumentationName[] = {