diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-02-14 17:58:31 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-02-19 11:35:40 (GMT) |
commit | 32d0ee3576c9203104a17c6a75bfc1bf13192045 (patch) | |
tree | 6a3cf6df84a050d2aa191b9a9fd7a9530e4bc692 /Source | |
parent | 119876e6d5e71fb8a3f72ba35593ee43fd124203 (diff) | |
download | CMake-32d0ee3576c9203104a17c6a75bfc1bf13192045.zip CMake-32d0ee3576c9203104a17c6a75bfc1bf13192045.tar.gz CMake-32d0ee3576c9203104a17c6a75bfc1bf13192045.tar.bz2 |
Autogen: Generate empty settings string for disabled feature
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 6f07716..3807c3d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -68,8 +68,10 @@ inline static bool SettingsMatch(cmMakefile* makefile, const char* key, static void SettingWrite(std::ostream& ostr, const char* key, const std::string& value) { - ostr << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) - << ")\n"; + if (!value.empty()) { + ostr << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) + << ")\n"; + } } static std::string FindMatchingHeader( @@ -429,32 +431,38 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( std::string cmQtAutoGenerators::SettingsStringGenMoc() { std::string res; - res += this->MocCompileDefinitionsStr; - res += " ~~~ "; - res += this->MocIncludesStr; - res += " ~~~ "; - res += this->MocOptionsStr; - res += " ~~~ "; - res += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE"; - res += " ~~~ "; + if (!this->MocExecutable.empty()) { + res += this->MocCompileDefinitionsStr; + res += " ~~~ "; + res += this->MocIncludesStr; + res += " ~~~ "; + res += this->MocOptionsStr; + res += " ~~~ "; + res += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE"; + res += " ~~~ "; + } return res; } std::string cmQtAutoGenerators::SettingsStringGenUic() { std::string res; - res += cmJoin(this->UicTargetOptions, "@osep@"); - res += " ~~~ "; - res += JoinOptions(this->UicOptions); - res += " ~~~ "; + if (!this->UicExecutable.empty()) { + res += cmJoin(this->UicTargetOptions, "@osep@"); + res += " ~~~ "; + res += JoinOptions(this->UicOptions); + res += " ~~~ "; + } return res; } std::string cmQtAutoGenerators::SettingsStringGenRcc() { std::string res; - res += JoinOptions(this->RccOptions); - res += " ~~~ "; + if (!this->RccExecutable.empty()) { + res += JoinOptions(this->RccOptions); + res += " ~~~ "; + } return res; } @@ -498,18 +506,17 @@ bool cmQtAutoGenerators::SettingsFileWrite(const std::string& targetDirectory) // Only write if any setting changed if (this->GenerateAllAny()) { const std::string filename = SettingsFile(targetDirectory); + if (this->Verbose) { + std::ostringstream err; + err << "AutoGen: Writing settings file " << filename << "\n"; + this->LogInfo(err.str()); + } cmsys::ofstream outfile; outfile.open(filename.c_str(), std::ios::trunc); if (outfile) { - if (!this->MocExecutable.empty()) { - SettingWrite(outfile, SettingsKeyMoc, this->MocSettingsString); - } - if (!this->UicExecutable.empty()) { - SettingWrite(outfile, SettingsKeyUic, this->UicSettingsString); - } - if (!this->RccExecutable.empty()) { - SettingWrite(outfile, SettingsKeyRcc, this->RccSettingsString); - } + SettingWrite(outfile, SettingsKeyMoc, this->MocSettingsString); + SettingWrite(outfile, SettingsKeyUic, this->UicSettingsString); + SettingWrite(outfile, SettingsKeyRcc, this->RccSettingsString); success = outfile.good(); outfile.close(); } else { |