summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorAndreas Oetken <andreas.oetken@siemens-energy.com>2024-04-15 13:32:44 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-15 20:34:22 (GMT)
commitd4a46314acb7702eed604c0881a740b48cd1fb0e (patch)
treed2f6992b15623f49a05ff110f54bea827a26e4ac /Source/CPack
parentabd572de909de2f30ca93e3b1cca1311e33c4f75 (diff)
downloadCMake-d4a46314acb7702eed604c0881a740b48cd1fb0e.zip
CMake-d4a46314acb7702eed604c0881a740b48cd1fb0e.tar.gz
CMake-d4a46314acb7702eed604c0881a740b48cd1fb0e.tar.bz2
CPack: Enable Inno Setup generator on non-Windows hosts
Innosetup tools can be run on Linux using Wine, thus there is no reason to block this in CMake.
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.cxx22
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.h9
2 files changed, 21 insertions, 10 deletions
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx
index dd0065f..17ea89f 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.cxx
+++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx
@@ -24,12 +24,7 @@ cmCPackInnoSetupGenerator::~cmCPackInnoSetupGenerator() = default;
bool cmCPackInnoSetupGenerator::CanGenerate()
{
- // Inno Setup is only available for Windows
-#ifdef _WIN32
return true;
-#else
- return false;
-#endif
}
int cmCPackInnoSetupGenerator::InitializeInternal()
@@ -63,7 +58,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
- const std::string isccCmd = cmStrCat(QuotePath(isccPath), "/?");
+ const std::string isccCmd =
+ cmStrCat(QuotePath(isccPath, PathType::Native), "/?");
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Test Inno Setup version: " << isccCmd << std::endl);
std::string output;
@@ -869,8 +865,8 @@ bool cmCPackInnoSetupGenerator::Compile()
}
const std::string& isccCmd =
- cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM")), ' ',
- cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
+ cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM"), PathType::Native),
+ ' ', cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << isccCmd << std::endl);
@@ -1136,8 +1132,16 @@ std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
return cmStrCat('"', nString, '"');
}
-std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path)
+std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
+ PathType type)
{
+#ifdef _WIN32
+ static_cast<void>(type);
+#else
+ if (type == PathType::Native) {
+ return Quote(cmSystemTools::ConvertToUnixOutputPath(path));
+ }
+#endif
return Quote(cmSystemTools::ConvertToWindowsOutputPath(path));
}
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.h b/Source/CPack/cmCPackInnoSetupGenerator.h
index 342f227..e057e6c 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.h
+++ b/Source/CPack/cmCPackInnoSetupGenerator.h
@@ -49,6 +49,12 @@ protected:
inline bool SupportsComponentInstallation() const override { return true; }
private:
+ enum class PathType
+ {
+ Windows,
+ Native,
+ };
+
bool ProcessSetupSection();
bool ProcessFiles();
bool ProcessComponents();
@@ -92,7 +98,8 @@ private:
* Paths are converted into the format used by Windows before.
*/
std::string Quote(const std::string& string);
- std::string QuotePath(const std::string& path);
+ std::string QuotePath(const std::string& path,
+ PathType type = PathType::Windows);
/**
* This function replaces the following 5 characters with their %-encoding: