[Cmake-commits] CMake branch, next, updated. v2.8.3-1258-g43425a2

David Cole david.cole at kitware.com
Fri Jan 7 14:45:18 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  43425a2ac22e0f46a1de20c51f820c6a6aa70025 (commit)
       via  1bbe4e69171f3155f262bb12f15437db4b71c207 (commit)
      from  2c0f00cf382008ab04fd95feddb4974cef2c70d0 (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=43425a2ac22e0f46a1de20c51f820c6a6aa70025
commit 43425a2ac22e0f46a1de20c51f820c6a6aa70025
Merge: 2c0f00c 1bbe4e6
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Jan 7 14:45:16 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 7 14:45:16 2011 -0500

    Merge topic 'fix-10644-cpack-menu-links' into next
    
    1bbe4e6 CPack: Detect more URLs in CPACK_NSIS_MENU_LINKS (#10644)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bbe4e69171f3155f262bb12f15437db4b71c207
commit 1bbe4e69171f3155f262bb12f15437db4b71c207
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Jan 7 14:24:04 2011 -0500
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Fri Jan 7 14:24:04 2011 -0500

    CPack: Detect more URLs in CPACK_NSIS_MENU_LINKS (#10644)
    
    Previously, only strings containing "http:" qualified as
    URLs when found in CPACK_NSIS_MENU_LINKS. Now, we use a
    regex to detect strings beginning with any of the following:
    
      ftp://
      ftps://
      http://
      https://
      news://
      mailto:
    
    This commit also moves the caller of CreateMenuLinks outside
    the "if (cpackPackageExecutables)" block, allowing clients to
    use CPACK_NSIS_MENU_LINKS without also having CPACK_PACKAGE_EXECUTABLES
    defined. That bit of this commit fixes the remainder of the
    issue described in http://public.kitware.com/Bug/view.php?id=7828
    
    Also, added a set(CPACK_NSIS_MENU_LINKS ...) to the CPackComponents
    test to enable verifying that all of this actually works.

diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index f25866c..f911ea8 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -440,12 +440,14 @@ int cmCPackNSISGenerator::InitializeInternal()
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: "
                   << "not set" << std::endl);
     }
+
+  cmOStringStream str;
+  cmOStringStream deleteStr;
+
   if ( cpackPackageExecutables )
     {
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: "
       << cpackPackageExecutables << "." << std::endl);
-    cmOStringStream str;
-    cmOStringStream deleteStr;
     std::vector<std::string> cpackPackageExecutablesVector;
     cmSystemTools::ExpandListArgument(cpackPackageExecutables,
       cpackPackageExecutablesVector);
@@ -486,11 +488,13 @@ int cmCPackNSISGenerator::InitializeInternal()
                   << ".lnk\"" << std::endl;
         }
       }
-    this->CreateMenuLinks(str, deleteStr);
-    this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
-    this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS", 
-                            deleteStr.str().c_str());
     }
+
+  this->CreateMenuLinks(str, deleteStr);
+  this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
+  this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS",
+                          deleteStr.str().c_str());
+
   this->SetOptionIfNotSet("CPACK_NSIS_COMPRESSOR", "lzma");
 
   return this->Superclass::InitializeInternal();
@@ -519,22 +523,25 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
       "<icon name>." << std::endl);
     return;
     }
+
+  cmsys::RegularExpression urlRegex;
+  urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$");
+
   std::vector<std::string>::iterator it;
   for ( it = cpackMenuLinksVector.begin();
         it != cpackMenuLinksVector.end();
         ++it )
     {
     std::string sourceName = *it;
-    bool url = false;
-    if(sourceName.find("http:") == 0)
-      {
-      url = true;
-      }
-    /* convert / to \\ */
+    const bool url = urlRegex.find(sourceName);
+
+    // Convert / to \ in filenames, but not in urls:
+    //
     if(!url)
       {
       cmSystemTools::ReplaceString(sourceName, "/", "\\");
       }
+
     ++ it;
     std::string linkName = *it;
     if(!url)
diff --git a/Tests/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt
index 3ef8083..bbe834d 100644
--- a/Tests/CPackComponents/CMakeLists.txt
+++ b/Tests/CPackComponents/CMakeLists.txt
@@ -68,6 +68,16 @@ set(CPACK_PACKAGE_VERSION_MINOR "0")
 set(CPACK_PACKAGE_VERSION_PATCH "0")
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
 
+# Settings used when building NSIS installers
+set(CPACK_NSIS_MENU_LINKS
+  "ftp://ftpserver" "Test Ftp Link"
+  "ftps://ftpsserver" "Test Ftps Link"
+  "http://www.cmake.org" "CMake Web Site"
+  "https://github.com/" "Test Https Link"
+  "mailto:kitware at kitware.com" "Test MailTo Link"
+  "news://newsserver" "Test News Link"
+  )
+
 # Include CPack to introduce the appropriate targets
 include(CPack)
 

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

Summary of changes:
 Source/CPack/cmCPackNSISGenerator.cxx |   31 +++++++++++++++++++------------
 Tests/CPackComponents/CMakeLists.txt  |   10 ++++++++++
 2 files changed, 29 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list