From cebefa71fad223f134529a2b859006360e465a80 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 12:11:32 -0500 Subject: cmTarget: Sort special property checks The LINK_LIBRARIES property is by *far* the most popular. Move it to the top. TYPE is second, but with more generator expression usage, that may change in the future. --- Source/cmTarget.cxx | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 62b30fd..09eb8a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3100,26 +3100,41 @@ const char *cmTarget::GetProperty(const std::string& prop, } if(specialProps.count(prop)) { - if(prop == "INCLUDE_DIRECTORIES") + if(prop == "LINK_LIBRARIES") { - if (this->Internal->IncludeDirectoriesEntries.empty()) + if (this->Internal->LinkImplementationPropertyEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + output = ""; + std::string sep; + for (std::vector::const_iterator + it = this->Internal->LinkImplementationPropertyEntries.begin(), + end = this->Internal->LinkImplementationPropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } return output.c_str(); } - else if(prop == "COMPILE_OPTIONS") + // the type property returns what type the target is + else if (prop == "TYPE") { - if (this->Internal->CompileOptionsEntries.empty()) + return cmTarget::GetTargetTypeName(this->GetType()); + } + else if(prop == "INCLUDE_DIRECTORIES") + { + if (this->Internal->IncludeDirectoriesEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); + MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); return output.c_str(); } else if(prop == "COMPILE_FEATURES") @@ -3133,36 +3148,26 @@ const char *cmTarget::GetProperty(const std::string& prop, MakePropertyList(output, this->Internal->CompileFeaturesEntries); return output.c_str(); } - else if(prop == "COMPILE_DEFINITIONS") + else if(prop == "COMPILE_OPTIONS") { - if (this->Internal->CompileDefinitionsEntries.empty()) + if (this->Internal->CompileOptionsEntries.empty()) { return 0; } static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + MakePropertyList(output, this->Internal->CompileOptionsEntries); return output.c_str(); } - else if(prop == "LINK_LIBRARIES") + else if(prop == "COMPILE_DEFINITIONS") { - if (this->Internal->LinkImplementationPropertyEntries.empty()) + if (this->Internal->CompileDefinitionsEntries.empty()) { return 0; } static std::string output; - output = ""; - std::string sep; - for (std::vector::const_iterator - it = this->Internal->LinkImplementationPropertyEntries.begin(), - end = this->Internal->LinkImplementationPropertyEntries.end(); - it != end; ++it) - { - output += sep; - output += it->Value; - sep = ";"; - } + MakePropertyList(output, this->Internal->CompileDefinitionsEntries); return output.c_str(); } else if (prop == "IMPORTED") @@ -3270,11 +3275,6 @@ const char *cmTarget::GetProperty(const std::string& prop, this->Properties.SetProperty("SOURCES", ss.str().c_str(), cmProperty::TARGET); } - // the type property returns what type the target is - else if (prop == "TYPE") - { - return cmTarget::GetTargetTypeName(this->GetType()); - } } bool chain = false; -- cgit v0.12