diff options
author | Brad King <brad.king@kitware.com> | 2011-01-11 20:48:24 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-01-11 20:48:24 (GMT) |
commit | 3272d2d96fc047cbee7610ec8747f21f57752c1e (patch) | |
tree | f9e8b2fd45227579c0302985135240ce4b707ef2 | |
parent | 7ebfa8218b58d0b835fa23a6e40afe8043a17d7e (diff) | |
parent | 1bbe4e69171f3155f262bb12f15437db4b71c207 (diff) | |
download | CMake-3272d2d96fc047cbee7610ec8747f21f57752c1e.zip CMake-3272d2d96fc047cbee7610ec8747f21f57752c1e.tar.gz CMake-3272d2d96fc047cbee7610ec8747f21f57752c1e.tar.bz2 |
Merge topic 'fix-10644-cpack-menu-links'
1bbe4e6 CPack: Detect more URLs in CPACK_NSIS_MENU_LINKS (#10644)
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 31 | ||||
-rw-r--r-- | Tests/CPackComponents/CMakeLists.txt | 10 |
2 files changed, 29 insertions, 12 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 97885d5..e5fe575 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -461,12 +461,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); @@ -509,11 +511,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(); @@ -542,22 +546,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@kitware.com" "Test MailTo Link" + "news://newsserver" "Test News Link" + ) + # Include CPack to introduce the appropriate targets include(CPack) |