diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-17 12:00:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-17 12:33:57 (GMT) |
commit | b915fec56e7b1768ea717bf4d970f8b4910c7829 (patch) | |
tree | ccbc863f50cad5ab08f30e8c0aa5c6101cb11aaa /Source | |
parent | bee0100396d4b0dad7204125606e6baf26b79e38 (diff) | |
download | CMake-b915fec56e7b1768ea717bf4d970f8b4910c7829.zip CMake-b915fec56e7b1768ea717bf4d970f8b4910c7829.tar.gz CMake-b915fec56e7b1768ea717bf4d970f8b4910c7829.tar.bz2 |
cmTarget: minor code improvements
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportInstallAndroidMKGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 46 | ||||
-rw-r--r-- | Source/cmTarget.h | 4 |
5 files changed, 30 insertions, 30 deletions
diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx index 9702e0e..80f776e 100644 --- a/Source/cmExportInstallAndroidMKGenerator.cxx +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -66,7 +66,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode( os << "LOCAL_MODULE := "; os << targetName << "\n"; os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/"; - os << target->Target->GetProperty("__dest") << "/"; + os << target->Target->GetSafeProperty("__dest") << "/"; std::string config; if (!this->Configurations.empty()) { config = this->Configurations[0]; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 8831d0f..c0db90f 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -910,8 +910,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode const char* loc = nullptr; const char* imp = nullptr; std::string suffix; - if (context->CurrentTarget->Target->GetMappedConfig( - context->Config, &loc, &imp, suffix)) { + if (context->CurrentTarget->Target->GetMappedConfig(context->Config, loc, + imp, suffix)) { // This imported target has an appropriate location // for this (possibly mapped) config. // Check if there is a proper config mapping for the tested config. @@ -1568,7 +1568,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode const char* loc = nullptr; const char* imp = nullptr; std::string suffix; - if (gt->Target->GetMappedConfig(context->Config, &loc, &imp, suffix)) { + if (gt->Target->GetMappedConfig(context->Config, loc, imp, suffix)) { cmExpandList(loc, objects); } context->HadContextSensitiveCondition = true; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index af45893..0c1afa8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -6338,7 +6338,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, const char* loc = nullptr; const char* imp = nullptr; std::string suffix; - if (!this->Target->GetMappedConfig(desired_config, &loc, &imp, suffix)) { + if (!this->Target->GetMappedConfig(desired_config, loc, imp, suffix)) { return; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f92eea4..03f1525 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1931,7 +1931,7 @@ std::string cmTarget::ImportedGetFullPath( std::string suffix; if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && - this->GetMappedConfig(desired_config, &loc, &imp, suffix)) { + this->GetMappedConfig(desired_config, loc, imp, suffix)) { switch (artifact) { case cmStateEnums::RuntimeBinaryArtifact: if (loc) { @@ -2001,7 +2001,7 @@ bool cmTargetInternals::CheckImportedLibName(std::string const& prop, } bool cmTarget::GetMappedConfig(std::string const& desired_config, - const char** loc, const char** imp, + const char*& loc, const char*& imp, std::string& suffix) const { std::string config_upper; @@ -2039,30 +2039,30 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, // If a mapping was found, check its configurations. for (auto mci = mappedConfigs.begin(); - !*loc && !*imp && mci != mappedConfigs.end(); ++mci) { + !loc && !imp && mci != mappedConfigs.end(); ++mci) { // Look for this configuration. if (mci->empty()) { // An empty string in the mapping has a special meaning: // look up the config-less properties. - *loc = this->GetProperty(locPropBase); + loc = this->GetProperty(locPropBase); if (allowImp) { - *imp = this->GetProperty("IMPORTED_IMPLIB"); + imp = this->GetProperty("IMPORTED_IMPLIB"); } // If it was found, set the suffix. - if (*loc || *imp) { + if (loc || imp) { suffix.clear(); } } else { std::string mcUpper = cmSystemTools::UpperCase(*mci); std::string locProp = cmStrCat(locPropBase, '_', mcUpper); - *loc = this->GetProperty(locProp); + loc = this->GetProperty(locProp); if (allowImp) { std::string impProp = cmStrCat("IMPORTED_IMPLIB_", mcUpper); - *imp = this->GetProperty(impProp); + imp = this->GetProperty(impProp); } // If it was found, use it for all properties below. - if (*loc || *imp) { + if (loc || imp) { suffix = cmStrCat('_', mcUpper); } } @@ -2071,59 +2071,59 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, // If we needed to find one of the mapped configurations but did not // then the target location is not found. The project does not want // any other configuration. - if (!mappedConfigs.empty() && !*loc && !*imp) { + if (!mappedConfigs.empty() && !loc && !imp) { // Interface libraries are always available because their - // library name is optional so it is okay to leave *loc empty. + // library name is optional so it is okay to leave loc empty. return this->GetType() == cmStateEnums::INTERFACE_LIBRARY; } // If we have not yet found it then there are no mapped // configurations. Look for an exact-match. - if (!*loc && !*imp) { + if (!loc && !imp) { std::string locProp = cmStrCat(locPropBase, suffix); - *loc = this->GetProperty(locProp); + loc = this->GetProperty(locProp); if (allowImp) { std::string impProp = cmStrCat("IMPORTED_IMPLIB", suffix); - *imp = this->GetProperty(impProp); + imp = this->GetProperty(impProp); } } // If we have not yet found it then there are no mapped // configurations and no exact match. - if (!*loc && !*imp) { + if (!loc && !imp) { // The suffix computed above is not useful. suffix.clear(); // Look for a configuration-less location. This may be set by // manually-written code. - *loc = this->GetProperty(locPropBase); + loc = this->GetProperty(locPropBase); if (allowImp) { - *imp = this->GetProperty("IMPORTED_IMPLIB"); + imp = this->GetProperty("IMPORTED_IMPLIB"); } } // If we have not yet found it then the project is willing to try // any available configuration. - if (!*loc && !*imp) { + if (!loc && !imp) { std::vector<std::string> availableConfigs; if (const char* iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) { cmExpandList(iconfigs, availableConfigs); } for (auto aci = availableConfigs.begin(); - !*loc && !*imp && aci != availableConfigs.end(); ++aci) { + !loc && !imp && aci != availableConfigs.end(); ++aci) { suffix = cmStrCat('_', cmSystemTools::UpperCase(*aci)); std::string locProp = cmStrCat(locPropBase, suffix); - *loc = this->GetProperty(locProp); + loc = this->GetProperty(locProp); if (allowImp) { std::string impProp = cmStrCat("IMPORTED_IMPLIB", suffix); - *imp = this->GetProperty(impProp); + imp = this->GetProperty(impProp); } } } // If we have not yet found it then the target location is not available. - if (!*loc && !*imp) { + if (!loc && !imp) { // Interface libraries are always available because their - // library name is optional so it is okay to leave *loc empty. + // library name is optional so it is okay to leave loc empty. return this->GetType() == cmStateEnums::INTERFACE_LIBRARY; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 286933b..463b234 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -191,8 +191,8 @@ public: bool IsImportedGloballyVisible() const; bool IsPerConfig() const; - bool GetMappedConfig(std::string const& desired_config, const char** loc, - const char** imp, std::string& suffix) const; + bool GetMappedConfig(std::string const& desired_config, const char*& loc, + const char*& imp, std::string& suffix) const; //! Return whether this target is an executable with symbol exports enabled. bool IsExecutableWithExports() const; |