[Cmake-commits] CMake branch, next, updated. v2.8.5-1901-g3af5413

Alexander Neundorf neundorf at kde.org
Fri Sep 16 07:40:08 EDT 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  3af54134b9239de12a1bb91ced41a908fcad83de (commit)
       via  c886e312bbd6e26f049215c8bcc821d9597fed8c (commit)
       via  31f43fdb5af80029bc644bffd853c81a25424623 (commit)
      from  c0c0b109c8262bfbdd24cd12c3129a697dc83b2a (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=3af54134b9239de12a1bb91ced41a908fcad83de
commit 3af54134b9239de12a1bb91ced41a908fcad83de
Merge: c0c0b10 c886e31
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Fri Sep 16 07:40:00 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Sep 16 07:40:00 2011 -0400

    Merge topic 'ImproveFindPackageModeWithTryCompile' into next
    
    c886e31 Improve behaviour of --find-package mode with try_run/try_compile
    31f43fd Remove trailing whitespace


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c886e312bbd6e26f049215c8bcc821d9597fed8c
commit c886e312bbd6e26f049215c8bcc821d9597fed8c
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Thu Sep 15 16:28:35 2011 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Thu Sep 15 16:28:35 2011 +0200

    Improve behaviour of --find-package mode with try_run/try_compile
    
    Instead of failing with an error message which says things have not been
    setup correctly, it now says that try_compile/try_run() are not
    supported in find_package mode (#12426).
    
    Alex

diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 4d39d54..546e42f 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -20,6 +20,14 @@ bool cmTryCompileCommand
     return false;
     }
 
+  if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
+                                                      cmake::FIND_PACKAGE_MODE)
+    {
+    cmSystemTools::Error(
+         "The TRY_COMPILE() command is not supported in --find-package mode.");
+    return false;
+    }
+
   this->TryCompileCode(argv);
 
   // if They specified clean then we clean up what we can
@@ -32,4 +40,3 @@ bool cmTryCompileCommand
     }
   return true;
 }
-
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index ce402a8..9044cf8 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -22,6 +22,14 @@ bool cmTryRunCommand
     return false;
     }
 
+  if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
+                                                      cmake::FIND_PACKAGE_MODE)
+    {
+    cmSystemTools::Error(
+            "The TRY_RUN() command is not supported in --find-package mode.");
+    return false;
+    }
+
   // build an arg list for TryCompile and extract the runArgs,
   std::vector<std::string> tryCompile;
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31f43fdb5af80029bc644bffd853c81a25424623
commit 31f43fdb5af80029bc644bffd853c81a25424623
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Thu Sep 15 16:20:33 2011 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Thu Sep 15 16:20:33 2011 +0200

    Remove trailing whitespace
    
    Alex

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 96a214e..dca2fb3 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -22,12 +22,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
   // which signature were we called with ?
   this->SrcFileSignature = false;
   unsigned int i;
-  
+
   const char* sourceDirectory = argv[2].c_str();
   const char* projectName = 0;
   const char* targetName = 0;
   int extraArgs = 0;
-  
+
   // look for CMAKE_FLAGS and store them
   std::vector<std::string> cmakeFlags;
   for (i = 3; i < argv.size(); ++i)
@@ -37,8 +37,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
      // CMAKE_FLAGS is the first argument because we need an argv[0] that
      // is not used, so it matches regular command line parsing which has
      // the program name as arg 0
-      for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" && 
-             argv[i] != "OUTPUT_VARIABLE"; 
+      for (; i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" &&
+             argv[i] != "OUTPUT_VARIABLE";
            ++i)
         {
         extraArgs++;
@@ -73,8 +73,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     if (argv[i] == "COMPILE_DEFINITIONS")
       {
       extraArgs++;
-      for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" && 
-             argv[i] != "OUTPUT_VARIABLE"; 
+      for (i = i + 1; i < argv.size() && argv[i] != "CMAKE_FLAGS" &&
+             argv[i] != "OUTPUT_VARIABLE";
            ++i)
         {
         extraArgs++;
@@ -101,7 +101,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       break;
       }
     }
-    
+
   // do we have a srcfile signature
   if (argv.size() - extraArgs == 3)
     {
@@ -133,7 +133,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     }
   // make sure the binary directory exists
   cmSystemTools::MakeDirectory(this->BinaryDirectory.c_str());
-  
+
   // do not allow recursive try Compiles
   if (this->BinaryDirectory == this->Makefile->GetHomeOutputDirectory())
     {
@@ -143,7 +143,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
     return -1;
     }
-  
+
   std::string outFileName = this->BinaryDirectory + "/CMakeLists.txt";
   // which signature are we using? If we are using var srcfile bindir
   if (this->SrcFileSignature)
@@ -151,7 +151,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     // remove any CMakeCache.txt files so we will have a clean test
     std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt";
     cmSystemTools::RemoveFile(ccFile.c_str());
-    
+
     // we need to create a directory and CMakeList file etc...
     // first create the directories
     sourceDirectory = this->BinaryDirectory.c_str();
@@ -226,7 +226,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     langFlags += "_FLAGS";
     fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n");
     fprintf(fout, "SET(CMAKE_%s_FLAGS \"", lang);
-    const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); 
+    const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
     if(flags)
       {
       fprintf(fout, " %s ", flags);
@@ -247,10 +247,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       }
 
     /* for the TRY_COMPILEs we want to be able to specify the architecture.
-      So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set 
+      So the user can set CMAKE_OSX_ARCHITECTURE to i386;ppc and then set
       CMAKE_TRY_COMPILE_OSX_ARCHITECTURE first to i386 and then to ppc to
-      have the tests run for each specific architecture. Since 
-      cmLocalGenerator doesn't allow building for "the other" 
+      have the tests run for each specific architecture. Since
+      cmLocalGenerator doesn't allow building for "the other"
       architecture only via CMAKE_OSX_ARCHITECTURES.
       */
     if(this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_OSX_ARCHITECTURES")!=0)
@@ -286,45 +286,45 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
             this->BinaryDirectory.c_str());
     /* Create the actual executable.  */
     fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
-    fprintf(fout, 
+    fprintf(fout,
             "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
     fclose(fout);
     projectName = "CMAKE_TRY_COMPILE";
     targetName = "cmTryCompileExec";
-    // if the source is not in CMakeTmp 
+    // if the source is not in CMakeTmp
     if(source.find("CMakeTmp") == source.npos)
       {
       this->Makefile->AddCMakeDependFile(source.c_str());
       }
-    
+
     }
   // else the srcdir bindir project target signature
   else
     {
     projectName = argv[3].c_str();
-    
+
     if (argv.size() - extraArgs == 5)
       {
       targetName = argv[4].c_str();
       }
     }
-  
+
   bool erroroc = cmSystemTools::GetErrorOccuredFlag();
   cmSystemTools::ResetErrorOccuredFlag();
   std::string output;
   // actually do the try compile now that everything is setup
-  int res = this->Makefile->TryCompile(sourceDirectory, 
+  int res = this->Makefile->TryCompile(sourceDirectory,
                                        this->BinaryDirectory.c_str(),
-                                       projectName, 
-                                       targetName, 
+                                       projectName,
+                                       targetName,
                                        this->SrcFileSignature,
-                                       &cmakeFlags, 
+                                       &cmakeFlags,
                                        &output);
   if ( erroroc )
     {
     cmSystemTools::SetErrorOccured();
     }
-  
+
   // set the result var to the return value to indicate success or failure
   this->Makefile->AddCacheDefinition(argv[0].c_str(),
                                      (res == 0 ? "TRUE" : "FALSE"),
@@ -335,7 +335,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
     {
     this->Makefile->AddDefinition(outputVariable.c_str(), output.c_str());
     }
-  
+
   if (this->SrcFileSignature)
     {
     this->FindOutputFile(targetName);
@@ -369,7 +369,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
     {
     return;
     }
-  
+
   std::string bdir = binDir;
   if(bdir.find("CMakeTmp") == std::string::npos)
     {
@@ -378,7 +378,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
       "CMakeTmp:", binDir);
     return;
     }
-  
+
   cmsys::Directory dir;
   dir.Load(binDir);
   size_t fileNum;
@@ -388,8 +388,8 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
     if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
         strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
       {
-      
-      if(deletedFiles.find( dir.GetFile(static_cast<unsigned long>(fileNum))) 
+
+      if(deletedFiles.find( dir.GetFile(static_cast<unsigned long>(fileNum)))
          == deletedFiles.end())
         {
         deletedFiles.insert(dir.GetFile(static_cast<unsigned long>(fileNum)));
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h
index e29dde8..5c67f13 100644
--- a/Source/cmCoreTryCompile.h
+++ b/Source/cmCoreTryCompile.h
@@ -28,27 +28,27 @@ public:
   /**
    * This is the core code for try compile. It is here so that other
    * commands, such as TryRun can access the same logic without
-   * duplication. 
+   * duplication.
    */
   int TryCompileCode(std::vector<std::string> const& argv);
 
-  /** 
-   * This deletes all the files created by TryCompileCode. 
+  /**
+   * This deletes all the files created by TryCompileCode.
    * This way we do not have to rely on the timing and
    * dependencies of makefiles.
    */
   void CleanupFiles(const char* binDir);
 
-  /** 
-   * This tries to find the (executable) file created by 
+  /**
+   * This tries to find the (executable) file created by
   TryCompileCode. The result is stored in OutputFile. If nothing is found,
   the error message is stored in FindErrorMessage.
    */
   void FindOutputFile(const char* targetName);
 
-  
+
   cmTypeMacro(cmCoreTryCompile, cmCommand);
-  
+
   std::string BinaryDirectory;
   std::string OutputFile;
   std::string FindErrorMessage;
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index c9c4ed5..ce402a8 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -49,8 +49,8 @@ bool cmTryRunCommand
         {
         tryCompile.push_back(argv[i]);
         }
-      } 
-    else 
+      }
+    else
       {
       if (argv[i] == "OUTPUT_VARIABLE")
         {
@@ -94,8 +94,8 @@ bool cmTryRunCommand
 
   // although they could be used together, don't allow it, because
   // using OUTPUT_VARIABLE makes crosscompiling harder
-  if (this->OutputVariable.size() 
-      && ((this->RunOutputVariable.size()) 
+  if (this->OutputVariable.size()
+      && ((this->RunOutputVariable.size())
        || (this->CompileOutputVariable.size())))
     {
     cmSystemTools::Error(
@@ -141,8 +141,8 @@ bool cmTryRunCommand
       std::string runOutputContents;
       if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))
         {
-        this->DoNotRunExecutable(runArgs, 
-                                 argv[3], 
+        this->DoNotRunExecutable(runArgs,
+                                 argv[3],
                                  captureRunOutput ? &runOutputContents : 0);
         }
       else
@@ -153,7 +153,7 @@ bool cmTryRunCommand
       // now put the output into the variables
       if(this->RunOutputVariable.size())
         {
-        this->Makefile->AddDefinition(this->RunOutputVariable.c_str(), 
+        this->Makefile->AddDefinition(this->RunOutputVariable.c_str(),
                                       runOutputContents.c_str());
         }
 
@@ -167,7 +167,7 @@ bool cmTryRunCommand
           {
           runOutputContents = std::string(compileOutput) + runOutputContents;
           }
-        this->Makefile->AddDefinition(this->OutputVariable.c_str(), 
+        this->Makefile->AddDefinition(this->OutputVariable.c_str(),
                                       runOutputContents.c_str());
         }
       }
@@ -212,9 +212,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
 
 /* This is only used when cross compiling. Instead of running the
  executable, two cache variables are created which will hold the results
- the executable would have produced. 
+ the executable would have produced.
 */
-void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, 
+void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
                                     const std::string& srcFile,
                                     std::string* out
                                     )
@@ -249,7 +249,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
     comment += "Run result of TRY_RUN(), indicates whether the executable "
                "would have been able to run on its target platform.\n";
     comment += detailsString;
-    this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(), 
+    this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(),
                                        "PLEASE_FILL_OUT-FAILED_TO_RUN",
                                        comment.c_str(),
                                        cmCacheManager::STRING);
@@ -276,7 +276,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
            "would have printed on stdout and stderr on its target platform.\n";
       comment += detailsString;
 
-      this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(), 
+      this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(),
                                          "PLEASE_FILL_OUT-NOTFOUND",
                                          comment.c_str(),
                                          cmCacheManager::STRING);
@@ -294,7 +294,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
   if (error)
     {
     static bool firstTryRun = true;
-    std::ofstream file(resultFileName.c_str(), 
+    std::ofstream file(resultFileName.c_str(),
                                   firstTryRun ? std::ios::out : std::ios::app);
     if ( file )
       {

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

Summary of changes:
 Source/cmCoreTryCompile.cxx    |   58 ++++++++++++++++++++--------------------
 Source/cmCoreTryCompile.h      |   14 +++++-----
 Source/cmTryCompileCommand.cxx |    9 +++++-
 Source/cmTryRunCommand.cxx     |   34 ++++++++++++++---------
 4 files changed, 65 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list