[Cmake-commits] CMake branch, next, updated. v2.8.3-1444-g2acfb25

Brad King brad.king at kitware.com
Thu Jan 20 09:09:39 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  2acfb25d43264514ae3712375b2543e57bf57414 (commit)
       via  1bee6b172bdeb4c02cafbc98d162e8d2cfd5c53f (commit)
      from  2418073e0f591d445d564537246f55ffa5641172 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2acfb25d43264514ae3712375b2543e57bf57414
commit 2acfb25d43264514ae3712375b2543e57bf57414
Merge: 2418073 1bee6b1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 20 09:09:37 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 20 09:09:37 2011 -0500

    Merge topic 'improve-try_compile-error-messages' into next
    
    1bee6b1 Improve try_compile and try_run error messages


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bee6b172bdeb4c02cafbc98d162e8d2cfd5c53f
commit 1bee6b172bdeb4c02cafbc98d162e8d2cfd5c53f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 20 08:58:49 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 20 08:58:49 2011 -0500

    Improve try_compile and try_run error messages
    
    Use IssueMessage to give the messages context and better formatting.

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dab0c0d..0ea6c5e 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1,6 +1,6 @@
 /*============================================================================
   CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
 
   Distributed under the OSI-approved BSD License (the "License");
   see accompanying file Copyright.txt for details.
@@ -56,7 +56,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       {
       if ( argv.size() <= (i+1) )
         {
-        cmSystemTools::Error(
+        this->Makefile->IssueMessage(cmake::FATAL_ERROR,
           "OUTPUT_VARIABLE specified but there is no variable");
         return -1;
         }
@@ -92,7 +92,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       {
       if ( argv.size() <= (i+1) )
         {
-        cmSystemTools::Error(
+        this->Makefile->IssueMessage(cmake::FATAL_ERROR,
           "COPY_FILE specified but there is no variable");
         return -1;
         }
@@ -120,13 +120,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     // only valid for srcfile signatures
     if (compileFlags.size())
       {
-      cmSystemTools::Error(
+      this->Makefile->IssueMessage(cmake::FATAL_ERROR,
         "COMPILE_FLAGS specified on a srcdir type TRY_COMPILE");
       return -1;
       }
     if (copyFile.size())
       {
-      cmSystemTools::Error("COPY_FILE specified on a srcdir type TRY_COMPILE");
+      this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+        "COPY_FILE specified on a srcdir type TRY_COMPILE");
       return -1;
       }
     }
@@ -136,9 +137,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
   // do not allow recursive try Compiles
   if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory())
     {
-    cmSystemTools::Error(
-      "Attempt at a recursive or nested TRY_COMPILE in directory ",
-      this->BinaryDirectory.c_str());
+    cmOStringStream e;
+    e << "Attempt at a recursive or nested TRY_COMPILE in directory\n"
+      << "  " << this->BinaryDirectory << "\n";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
     return -1;
     }
   
@@ -158,9 +160,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     FILE *fout = fopen(outFileName.c_str(),"w");
     if (!fout)
       {
-      cmSystemTools::Error("Failed to create CMakeList file for ", 
-                           outFileName.c_str());
-      cmSystemTools::ReportLastSystemError("");
+      cmOStringStream e;
+      e << "Failed to open\n"
+        << "  " << outFileName.c_str() << "\n"
+        << cmSystemTools::GetLastSystemError();
+      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
       return -1;
       }
 
@@ -181,10 +185,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       }
     else
       {
+      fclose(fout);
       cmOStringStream err;
-      err << "Unknown extension \"" << ext << "\" for file \""
-          << source << "\".  TRY_COMPILE only works for enabled languages.\n"
-          << "Currently enabled languages are:";
+      err << "Unknown extension \"" << ext << "\" for file\n"
+          << "  " << source << "\n"
+          << "try_compile() works only for enabled languages.  "
+          << "Currently these are:\n ";
       std::vector<std::string> langs;
       this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->
         GetEnabledLanguages(langs);
@@ -193,9 +199,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
         {
         err << " " << *l;
         }
-      err << "\nSee PROJECT command for help enabling other languages.";
-      cmSystemTools::Error(err.str().c_str());
-      fclose(fout);
+      err << "\nSee project() command to enable other languages.";
+      this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
       return -1;
       }
     std::string langFlags = "CMAKE_";
@@ -322,17 +327,15 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
                                         copyFile.c_str()))
         {
         cmOStringStream emsg;
-        emsg << "Could not COPY_FILE.\n"
-          << "  OutputFile: '" << this->OutputFile.c_str() << "'\n"
-          << "    copyFile: '" << copyFile.c_str() << "'\n";
-
-        if (this->FindErrorMessage.size())
+        emsg << "Cannot copy output executable\n"
+             << "  '" << this->OutputFile.c_str() << "'\n"
+             << "to destination specified by COPY_FILE:\n"
+             << "  '" << copyFile.c_str() << "'\n";
+        if(!this->FindErrorMessage.empty())
           {
-          emsg << "\n";
-          emsg << this->FindErrorMessage.c_str() << "\n";
+          emsg << this->FindErrorMessage.c_str();
           }
-
-        cmSystemTools::Error(emsg.str().c_str());
+        this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
         return -1;
         }
       }
@@ -449,18 +452,11 @@ void cmCoreTryCompile::FindOutputFile(const char* targetName)
     }
 
   cmOStringStream emsg;
-  emsg << "Unable to find executable for " << this->GetName() << ": tried \"";
+  emsg << "Unable to find the executable at any of:\n";
   for (unsigned int i = 0; i < searchDirs.size(); ++i)
     {
-    emsg << this->BinaryDirectory << searchDirs[i] << tmpOutputFile;
-    if (i < searchDirs.size() - 1)
-      {
-      emsg << "\" and \"";
-      }
-    else
-      {
-      emsg << "\".";
-      }
+    emsg << "  " << this->BinaryDirectory << searchDirs[i]
+         << tmpOutputFile << "\n";
     }
   this->FindErrorMessage = emsg.str();
   return;

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCoreTryCompile.cxx |   68 ++++++++++++++++++++----------------------
 1 files changed, 32 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list