Merge topic 'cpackifw-package-file-extension'

45623e72 CPackIFW: Add CPACK_IFW_PACKAGE_FILE_EXTENSION variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !1117
This commit is contained in:
Brad King 2017-08-15 17:08:19 +00:00 committed by Kitware Robot
commit 8fb9a5770a
4 changed files with 46 additions and 12 deletions

View File

@ -0,0 +1,6 @@
cpackifw-package-file-extension
-------------------------------
* The :module:`CPackIFW` module gained new
:variable:`CPACK_IFW_PACKAGE_FILE_EXTENSION` variable to customize
target binary format.

View File

@ -221,6 +221,19 @@
# You can use :command:`cpack_ifw_add_package_resources` command to resolve
# relative paths.
#
# .. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION
#
# The target binary extension.
#
# On Linux, the name of the target binary is automatically extended with
# '.run', if you do not specify the extension.
#
# On Windows, the target is created as an application with the extension
# '.exe', which is automatically added, if not supplied.
#
# On Mac, the target is created as an DMG disk image with the extension
# '.dmg', which is automatically added, if not supplied.
#
# .. variable:: CPACK_IFW_REPOSITORIES_ALL
#
# The list of remote repositories.

View File

@ -164,6 +164,7 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " " + this->packageFileNames[0];
} else {
ifwCmd += " installer";
ifwCmd += this->OutputExtension;
}
cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl);
std::string output;
@ -205,7 +206,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
const char* cmCPackIFWGenerator::GetOutputExtension()
{
return this->ExecutableSuffix.c_str();
return this->OutputExtension.c_str();
}
int cmCPackIFWGenerator::InitializeInternal()
@ -305,16 +306,29 @@ int cmCPackIFWGenerator::InitializeInternal()
}
// Executable suffix
if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) {
this->ExecutableSuffix = optExeSuffix;
if (this->ExecutableSuffix.empty()) {
std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
if (sysName == "Linux") {
this->ExecutableSuffix = ".run";
}
}
std::string exeSuffix(this->GetOption("CMAKE_EXECUTABLE_SUFFIX"));
std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
if (sysName == "Linux") {
this->ExecutableSuffix = ".run";
} else if (sysName == "Windows") {
this->ExecutableSuffix = ".exe";
} else if (sysName == "Darwin") {
this->ExecutableSuffix = ".app";
} else {
this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension();
this->ExecutableSuffix = exeSuffix;
}
// Output extension
if (const char* optOutExt =
this->GetOption("CPACK_IFW_PACKAGE_FILE_EXTENSION")) {
this->OutputExtension = optOutExt;
} else if (sysName == "Darwin") {
this->OutputExtension = ".dmg";
} else {
this->OutputExtension = this->ExecutableSuffix;
}
if (this->OutputExtension.empty()) {
this->OutputExtension = this->cmCPackGenerator::GetOutputExtension();
}
return this->Superclass::InitializeInternal();

View File

@ -61,8 +61,8 @@ protected:
const char* GetPackagingInstallPrefix() CM_OVERRIDE;
/**
* @brief Extension of binary installer
* @return Executable suffix or value from default implementation
* @brief Target binary extension
* @return Executable suffix or disk image format
*/
const char* GetOutputExtension() CM_OVERRIDE;
@ -143,6 +143,7 @@ private:
std::string BinCreator;
std::string FrameworkVersion;
std::string ExecutableSuffix;
std::string OutputExtension;
bool OnlineOnly;
bool ResolveDuplicateNames;