Genex: Make LINK_LANGUAGE report an error when evaluating link libraries.
This commit is contained in:
parent
0e1cb07e84
commit
b1c19ce383
|
@ -415,8 +415,15 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
|
||||||
std::string Evaluate(const std::vector<std::string> ¶meters,
|
std::string Evaluate(const std::vector<std::string> ¶meters,
|
||||||
cmGeneratorExpressionContext *context,
|
cmGeneratorExpressionContext *context,
|
||||||
const GeneratorExpressionContent *content,
|
const GeneratorExpressionContent *content,
|
||||||
cmGeneratorExpressionDAGChecker *) const
|
cmGeneratorExpressionDAGChecker *dagChecker) const
|
||||||
{
|
{
|
||||||
|
if (dagChecker && dagChecker->EvaluatingLinkLibraries())
|
||||||
|
{
|
||||||
|
reportError(context, content->GetOriginalExpression(),
|
||||||
|
"$<LINK_LANGUAGE> expression can not be used while evaluating "
|
||||||
|
"link libraries");
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
if (parameters.size() != 0 && parameters.size() != 1)
|
if (parameters.size() != 0 && parameters.size() != 1)
|
||||||
{
|
{
|
||||||
reportError(context, content->GetOriginalExpression(),
|
reportError(context, content->GetOriginalExpression(),
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,6 @@
|
||||||
|
CMake Error:
|
||||||
|
Error evaluating generator expression:
|
||||||
|
|
||||||
|
\$<LINK_LANGUAGE>
|
||||||
|
|
||||||
|
\$<LINK_LANGUAGE> expression can not be used while evaluating link libraries
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
add_library(foo SHARED empty.cpp)
|
||||||
|
add_library(bar SHARED empty.cpp)
|
||||||
|
target_link_libraries(foo $<$<STREQUAL:$<LINK_LANGUAGE>,anything>:bar>)
|
|
@ -1,3 +1,4 @@
|
||||||
include(RunCMake)
|
include(RunCMake)
|
||||||
|
|
||||||
run_cmake(NoLangSHARED)
|
run_cmake(NoLangSHARED)
|
||||||
|
run_cmake(LINK_LANGUAGE-genex)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#ifdef _WIN32
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
int empty(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue