mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
cmGeneratorExpressionNode: Factor out HasKnownObjectFileLocation check
This commit is contained in:
@@ -52,6 +52,31 @@
|
|||||||
#include "cmValue.h"
|
#include "cmValue.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool HasKnownObjectFileLocation(cm::GenEx::Evaluation* eval,
|
||||||
|
GeneratorExpressionContent const* content,
|
||||||
|
std::string const& genex,
|
||||||
|
cmGeneratorTarget const* target)
|
||||||
|
{
|
||||||
|
std::string reason;
|
||||||
|
if (!eval->EvaluateForBuildsystem &&
|
||||||
|
!target->Target->HasKnownObjectFileLocation(&reason)) {
|
||||||
|
std::ostringstream e;
|
||||||
|
e << "The evaluation of the " << genex
|
||||||
|
<< " generator expression "
|
||||||
|
"is only suitable for consumption by CMake (limited"
|
||||||
|
<< reason
|
||||||
|
<< "). "
|
||||||
|
"It is not suitable for writing out elsewhere.";
|
||||||
|
reportError(eval, content->GetOriginalExpression(), e.str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
||||||
std::string const& prop, cm::GenEx::Evaluation* eval,
|
std::string const& prop, cm::GenEx::Evaluation* eval,
|
||||||
cmGeneratorTarget const* headTarget,
|
cmGeneratorTarget const* headTarget,
|
||||||
@@ -3282,19 +3307,8 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
cmGlobalGenerator const* gg = eval->Context.LG->GetGlobalGenerator();
|
cmGlobalGenerator const* gg = eval->Context.LG->GetGlobalGenerator();
|
||||||
{
|
if (!HasKnownObjectFileLocation(eval, content, "TARGET_OBJECTS", gt)) {
|
||||||
std::string reason;
|
return std::string();
|
||||||
if (!eval->EvaluateForBuildsystem &&
|
|
||||||
!gt->Target->HasKnownObjectFileLocation(&reason)) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "The evaluation of the TARGET_OBJECTS generator expression "
|
|
||||||
"is only suitable for consumption by CMake (limited"
|
|
||||||
<< reason
|
|
||||||
<< "). "
|
|
||||||
"It is not suitable for writing out elsewhere.";
|
|
||||||
reportError(eval, content->GetOriginalExpression(), e.str());
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmList objects;
|
cmList objects;
|
||||||
|
Reference in New Issue
Block a user