diff options
author | Simon Levermann <Simon.Levermann@governikus.de> | 2015-11-24 15:17:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-12-02 13:26:01 (GMT) |
commit | ae434ee2dd1a91cd8ec53a631d8db9949d5f46b0 (patch) | |
tree | 2b187fb4979b9a1c1e1bc626ff759429aa89b9ae /Source/CPack | |
parent | 3c6a3668760ba48dde33f20de08dc6e16cfe7ab3 (diff) | |
download | CMake-ae434ee2dd1a91cd8ec53a631d8db9949d5f46b0.zip CMake-ae434ee2dd1a91cd8ec53a631d8db9949d5f46b0.tar.gz CMake-ae434ee2dd1a91cd8ec53a631d8db9949d5f46b0.tar.bz2 |
CPack/DragNDrop: Allow single license for multiple languages
When both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE are defined,
use the license file for all languages instead of looking for a license
file for each language. Also expand the documentation on the SLA
variables.
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.h | 1 |
2 files changed, 17 insertions, 7 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index b5df2d0..1a694ea 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -69,6 +69,7 @@ static const char* SLASTREnglish = //---------------------------------------------------------------------- cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() + : singleLicense(false) { // default to one package file for components this->componentPackageMethod = ONE_PACKAGE; @@ -131,10 +132,11 @@ int cmCPackDragNDropGenerator::InitializeInternal() if(!license_file.empty() && (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, " - "defaulting to CPACK_DMG_SLA_DIR" + "using CPACK_RESOURCE_FILE_LICENSE as a license for all languages." << std::endl); + singleLicense = true; } } if(!this->IsSet("CPACK_DMG_SLA_LANGUAGES")) @@ -166,7 +168,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() for(size_t i = 0; i < languages.size(); ++i) { std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; - if (!cmSystemTools::FileExists(license)) + if (!singleLicense && !cmSystemTools::FileExists(license)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing license file " << languages[i] << ".license.txt" @@ -366,7 +368,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // use sla_dir if both sla_dir and license_file are set if(!cpack_license_file.empty() && - !slaDirectory.empty()) + !slaDirectory.empty() && !singleLicense) { cpack_license_file = ""; } @@ -699,7 +701,14 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, { for(size_t i = 0; i < languages.size(); ++i) { - WriteLicense(ofs, i + 5000, languages[i]); + if(singleLicense) + { + WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + } + else + { + WriteLicense(ofs, i + 5000, languages[i]); + } } } @@ -850,7 +859,7 @@ void cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile) { - if(!licenseFile.empty()) + if(!licenseFile.empty() && !singleLicense) { licenseNumber = 5002; licenseLanguage = "English"; @@ -887,7 +896,7 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, // End of License outputStream << "};\n\n"; - if(!licenseFile.empty()) + if(!licenseFile.empty() && !singleLicense) { outputStream << SLASTREnglish; } diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 53d38c4..b5e5ffe 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -48,6 +48,7 @@ protected: private: std::string slaDirectory; + bool singleLicense; void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile = ""); |