Merge topic 'minor-cleanup'

b51b6e9 Export: Skip INTERFACE libraries when generating -config files.
cad5c79 cmTarget: Fix typo
08e72a3 Automoc: Fix style
2eda924 Genex: Use case-sensitive comparison in PLATFORM_ID.
9436353 Genex: Always return immediately on error.
20a06d0 Export: Clean up comment.
f4d9466 Genex: Accept arbitrary content in *_CASE and MAKE_C_IDENTIFIER.
d36b489 Genex: Allow single param expressions to accept arbirary input.
218ad35 Constify cmStrCmp.
4cb7d79 Help: Fix CMP0037 docs.
5187580 Help: Add missing period.
This commit is contained in:
Brad King 2013-12-20 09:41:40 -05:00 committed by CMake Topic Stage
commit 28d9aba7d6
12 changed files with 56 additions and 58 deletions

View File

@ -11,7 +11,7 @@ until later at generate-time, such as the link language and complete
list of link libraries. Future refactoring will change the effect of
the export() command to be executed at generate-time. Use ALIAS
targets instead in cases where the goal is to refer to targets by
another name
another name.
The OLD behavior for this policy is to allow including the result of
an export() command. The NEW behavior for this policy is to not to

View File

@ -11,7 +11,7 @@ diagnostics expect target names to match a restricted pattern.
Target names may contain upper and lower case letters, numbers, the underscore
character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS
targets and INTERFACE library targets may contain two consequtive colons.
targets and IMPORTED targets may contain two consequtive colons.
Target names reserved by one or more CMake generators are not allowed.
Among others these include "all", "help" and "test".

View File

@ -229,10 +229,8 @@ cmExportBuildFileGenerator::HandleMissingTarget(
// Append it with the export namespace.
link_libs += this->Namespace;
link_libs += dependee->GetExportName();
// if generate time {}
}
//----------------------------------------------------------------------------
std::vector<std::string>
cmExportBuildFileGenerator

View File

@ -297,16 +297,14 @@ cmExportInstallFileGenerator
{
// Collect import properties for this target.
cmTargetExport const* te = *tei;
ImportPropertyMap properties;
std::set<std::string> importedLocations;
if (!properties.empty()
&& te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
if (te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
this->GenerateImportPropertyCode(os, config, te->Target, properties);
this->GenerateImportedFileChecksCode(os, te->Target, properties,
importedLocations);
continue;
}
ImportPropertyMap properties;
std::set<std::string> importedLocations;
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,

View File

@ -82,7 +82,6 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
// Unreachable
return std::string();
}
} zeroNode;
@ -94,13 +93,12 @@ static const struct OneNode : public cmGeneratorExpressionNode
virtual bool AcceptsArbitraryContentParameter() const { return true; }
std::string Evaluate(const std::vector<std::string> &,
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
// Unreachable
return std::string();
return parameters.front();
}
} oneNode;
@ -203,6 +201,8 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
bool AcceptsArbitraryContentParameter() const { return true; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@ -217,6 +217,8 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode
{
UpperCaseNode() {}
bool AcceptsArbitraryContentParameter() const { return true; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@ -231,6 +233,8 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
{
MakeCIdentifierNode() {}
bool AcceptsArbitraryContentParameter() const { return true; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@ -350,6 +354,7 @@ static const struct CCompilerIdNode : public CompilerIdNode
reportError(context, content->GetOriginalExpression(),
"$<C_COMPILER_ID> may only be used with targets. It may not "
"be used with add_custom_command.");
return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "C");
@ -377,6 +382,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
reportError(context, content->GetOriginalExpression(),
"$<CXX_COMPILER_ID> may only be used with targets. It may not "
"be used with add_custom_command.");
return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "CXX");
@ -444,6 +450,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
reportError(context, content->GetOriginalExpression(),
"$<C_COMPILER_VERSION> may only be used with targets. It may not "
"be used with add_custom_command.");
return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "C");
@ -472,6 +479,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
reportError(context, content->GetOriginalExpression(),
"$<CXX_COMPILER_VERSION> may only be used with targets. It may "
"not be used with add_custom_command.");
return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "CXX");
@ -504,7 +512,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0";
}
if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0)
if (strcmp(parameters.begin()->c_str(), platformId) == 0)
{
return "1";
}
@ -1634,14 +1642,6 @@ std::string GeneratorExpressionContent::Evaluate(
return std::string();
}
if (node->NumExpectedParameters() == 1
&& node->AcceptsArbitraryContentParameter())
{
return this->ProcessArbitraryContent(node, identifier, context,
dagChecker,
this->ParamChildren.begin());
}
std::vector<std::string> parameters;
this->EvaluateParameters(node, identifier, context, dagChecker, parameters);
if (context->HadError)
@ -1669,33 +1669,35 @@ std::string GeneratorExpressionContent::EvaluateParameters(
pend = this->ParamChildren.end();
const bool acceptsArbitraryContent
= node->AcceptsArbitraryContentParameter();
for ( ; pit != pend; ++pit)
int counter = 1;
for ( ; pit != pend; ++pit, ++counter)
{
std::string parameter;
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
pit->begin();
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
pit->end();
for ( ; it != end; ++it)
if (acceptsArbitraryContent && counter == numExpected)
{
parameter += (*it)->Evaluate(context, dagChecker);
if (context->HadError)
{
return std::string();
}
}
parameters.push_back(parameter);
if (acceptsArbitraryContent
&& parameters.size() == (unsigned int)numExpected - 1)
{
assert(pit != pend);
std::string lastParam = this->ProcessArbitraryContent(node, identifier,
context,
dagChecker,
pit + 1);
pit);
parameters.push_back(lastParam);
return std::string();
}
else
{
std::string parameter;
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
pit->begin();
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
pit->end();
for ( ; it != end; ++it)
{
parameter += (*it)->Evaluate(context, dagChecker);
if (context->HadError)
{
return std::string();
}
}
parameters.push_back(parameter);
}
}
}

View File

@ -1379,18 +1379,18 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
if (this->RunMocFailed)
{
std::cerr << "moc failed..."<< std::endl;
std::cerr << "moc failed..." << std::endl;
return false;
}
if (this->RunUicFailed)
{
std::cerr << "uic failed..."<< std::endl;
std::cerr << "uic failed..." << std::endl;
return false;
}
if (this->RunRccFailed)
{
std::cerr << "rcc failed..."<< std::endl;
std::cerr << "rcc failed..." << std::endl;
return false;
}
outStream.flush();

View File

@ -423,19 +423,19 @@ struct cmStrCmp {
cmStrCmp(const char *test) : m_test(test) {}
cmStrCmp(std::string &test) : m_test(test.c_str()) {}
bool operator()(const char * input)
bool operator()(const char * input) const
{
return strcmp(input, m_test) == 0;
}
// For use with binary_search
bool operator()(const char *str1, const char *str2)
bool operator()(const char *str1, const char *str2) const
{
return strcmp(str1, str2) < 0;
}
private:
const char *m_test;
const char * const m_test;
};
#endif

View File

@ -5614,7 +5614,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
{
e << "Target \"" << this->GetName() << "\" links to target \"" << item
<< "\" but the target was not found. Perhaps a find_package() "
"call is missing for an IMPORTED target, or a ALIAS target is "
"call is missing for an IMPORTED target, or an ALIAS target is "
"missing?";
this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
e.str(),

View File

@ -193,9 +193,9 @@ add_custom_target(check-part3 ALL
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
-Dlower_case=$<LOWER_CASE:MiXeD>
-Dupper_case=$<UPPER_CASE:MiXeD>
-Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4foo:+bar-$>
-Dlower_case=$<LOWER_CASE:Mi,XeD>
-Dupper_case=$<UPPER_CASE:MiX,eD>
-Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4f,oo:+bar-$>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
VERBATIM

View File

@ -34,6 +34,6 @@ foreach(system Linux Windows Darwin)
check(test_platform_id_${system} 0)
endif()
endforeach()
check(lower_case "mixed")
check(upper_case "MIXED")
check(make_c_identifier "_4foo__bar__")
check(lower_case "mi,xed")
check(upper_case "MIX,ED")
check(make_c_identifier "_4f_oo__bar__")

View File

@ -1,6 +1,6 @@
CMake Error at CMP0028-NEW.cmake:4 \(add_library\):
Target "foo" links to target "External::Library" but the target was not
found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or
a ALIAS target is missing\?
an ALIAS target is missing\?
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -5,7 +5,7 @@ CMake Warning \(dev\) at CMP0028-WARN.cmake:2 \(add_library\):
Target "foo" links to target "External::Library" but the target was not
found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or
a ALIAS target is missing\?
an ALIAS target is missing\?
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.