diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 9a03c1526..dba4272cd 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -85,7 +85,7 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *, { makeCommand += "ALL_BUILD"; } - makeCommand += " - Debug\" /REBUILD"; + makeCommand += " - Debug\""; int retVal; if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal)) @@ -96,6 +96,10 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *, return 1; } cmSystemTools::ChangeDirectory(cwd.c_str()); + if (retVal) + { + cmSystemTools::Error("Generator: msdev returned a failure."); + } return retVal; } diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index e7fe9d1fb..8638dd907 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -26,8 +26,8 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv) } // where will the binaries be stored - const char* binaryDirectory = argv[2].c_str(); - const char* sourceDirectory = argv[1].c_str(); + const char* binaryDirectory = argv[1].c_str(); + const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; const char* targetName = 0; std::string tmpString; @@ -36,10 +36,13 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv) // signature if (argv.size() == 3) { - tmpString = argv[2] + "/CMakeTmp"; + tmpString = argv[1] + "/CMakeTmp"; binaryDirectory = tmpString.c_str(); } + // make sure the binary directory exists + cmSystemTools::MakeDirectory(binaryDirectory); + // do not allow recursive try Compiles if (!strcmp(binaryDirectory,m_Makefile->GetHomeOutputDirectory())) { @@ -58,7 +61,6 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv) // we need to create a directory and CMakeList file etc... // first create the directories sourceDirectory = binaryDirectory; - cmSystemTools::MakeDirectory(binaryDirectory); // now create a CMakeList.txt file in that directory std::string outFileName = tmpString + "/CMakeLists.txt"; @@ -70,7 +72,7 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv) return false; } fprintf(fout,"PROJECT(CMAKE_TRY_COMPILE)\n"); - fprintf(fout,"ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",argv[1].c_str()); + fprintf(fout,"ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",argv[2].c_str()); fclose(fout); projectName = "CMAKE_TRY_COMPILE"; targetName = "cmTryCompileExec"; diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 047fb3c7f..8658ac845 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -62,11 +62,11 @@ public: virtual const char* GetFullDocumentation() { return - "TRY_COMPILE(RESULT_VAR srcdir bindir projectName )\n" + "TRY_COMPILE(RESULT_VAR bindir srcdir projectName )\n" "Try compiling a program. Return the success or failure in RESULT_VAR " "If is specified then build just that target " "otherwise the all or ALL_BUILD target is built.\n" - "TRY_COMPILE(RESULT_VAR srcfile bindir)\n" + "TRY_COMPILE(RESULT_VAR bindir srcfile)\n" "Try compiling a srcfile. Return the success or failure in RESULT_VAR."; }