[Cmake-commits] CMake branch, next, updated. v2.8.7-2680-gb8bc894

Brad King brad.king at kitware.com
Fri Feb 17 11:57:14 EST 2012


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  b8bc894ae032747a8b6e127d5fb291ae28d4fbd1 (commit)
       via  4fbdce2b79b28566ae2c6708c99af5e0e8e0177b (commit)
      from  21b4d1168a86a62b21490c85acb9a4746bda4b2a (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=b8bc894ae032747a8b6e127d5fb291ae28d4fbd1
commit b8bc894ae032747a8b6e127d5fb291ae28d4fbd1
Merge: 21b4d11 4fbdce2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 17 11:57:11 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 17 11:57:11 2012 -0500

    Merge topic 'try-compile-random-name' into next
    
    4fbdce2 try_compile: Use random executable file name (#12957)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fbdce2b79b28566ae2c6708c99af5e0e8e0177b
commit 4fbdce2b79b28566ae2c6708c99af5e0e8e0177b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Feb 13 10:02:58 2012 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 16 10:13:50 2012 -0500

    try_compile: Use random executable file name (#12957)
    
    Append a random number to the "cmTryCompileExec" file name to avoid
    rapid creation and deletion of the same executable file name.  Some
    filesystems lock executable files when they are created and cause
    subsequent try-compile tests to fail arbitrarily.  Use a different
    name each time to avoid conflict.

diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dca2fb3..7d84ba6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -26,6 +26,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
   const char* sourceDirectory = argv[2].c_str();
   const char* projectName = 0;
   const char* targetName = 0;
+  char targetNameBuf[64];
   int extraArgs = 0;
 
   // look for CMAKE_FLAGS and store them
@@ -281,16 +282,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
       cmakeFlags.push_back(flag);
       }
 
+    /* Use a random file name to avoid rapid creation and deletion
+       of the same executable name (some filesystems fail on that).  */
+    sprintf(targetNameBuf, "cmTryCompileExec%u",
+            cmSystemTools::RandomSeed());
+    targetName = targetNameBuf;
+
     /* Put the executable at a known location (for COPY_FILE).  */
     fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
             this->BinaryDirectory.c_str());
     /* Create the actual executable.  */
-    fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
-    fprintf(fout,
-            "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
+    fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
+    fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
     fclose(fout);
     projectName = "CMAKE_TRY_COMPILE";
-    targetName = "cmTryCompileExec";
     // if the source is not in CMakeTmp
     if(source.find("CMakeTmp") == source.npos)
       {

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

Summary of changes:
 Source/cmCoreTryCompile.cxx |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list