mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-03 05:08:47 -06:00
cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys usage requirements for the purposes of compilation. Its intended use is to avoid needing to export targets that do not have link usage requirements (e.g., header-only libraries) when used by another target. See: #15415
This commit is contained in:
@@ -1363,14 +1363,13 @@ static const struct CompileOnlyNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
if (!dagChecker) {
|
||||
reportError(context, content->GetOriginalExpression(),
|
||||
"$<COMPILE_ONLY:...> may only be used via linking");
|
||||
"$<COMPILE_ONLY:...> may only be used for linking");
|
||||
return std::string();
|
||||
}
|
||||
// Linking checks for the inverse, so compiling is the opposite.
|
||||
if (dagChecker->GetTransitivePropertiesOnly()) {
|
||||
return parameters.front();
|
||||
}
|
||||
return std::string();
|
||||
return std::string{};
|
||||
}
|
||||
} compileOnlyNode;
|
||||
|
||||
@@ -1389,8 +1388,7 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode
|
||||
"$<LINK_ONLY:...> may only be used for linking");
|
||||
return std::string();
|
||||
}
|
||||
// Compile-only checks for the inverse, so linking is the opposite.
|
||||
if (!dagChecker->GetTransitivePropertiesOnly()) {
|
||||
if (!dagChecker->GetTransitivePropertiesOnlyCMP0131()) {
|
||||
return parameters.front();
|
||||
}
|
||||
return std::string();
|
||||
|
||||
Reference in New Issue
Block a user