Commit 1da75022 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

Don't include generator expressions in old-style link handling.

Don't add generator expressions to variables which are used
for CMP0003, CMP0004, and the old-style _LIB_DEPENDS content. They
will not be evaluated when read anyway and would probably confuse
the code reading them.

This makes it legitimate to use target_link_libraries with generator
expressions as arguments.
parent 9822f8c9
......@@ -2232,6 +2232,14 @@ static std::string targetNameGenex(const char *lib)
return std::string("$<TARGET_NAME:") + lib + ">";
static bool isGeneratorExpression(const std::string &lib)
const std::string::size_type openpos = lib.find("$<");
return (openpos != std::string::npos)
&& (lib.find(">", openpos) != std::string::npos);
void cmTarget::AddLinkLibrary(cmMakefile& mf,
const char *target, const char* lib,
......@@ -2254,6 +2262,11 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
if (isGeneratorExpression(lib))
cmTarget::LibraryID tmp;
tmp.first = lib;
tmp.second = llt;
......@@ -13,6 +13,7 @@
#define cmTargetLinkLibrariesCommand_h
#include "cmCommand.h"
#include "cmDocumentGeneratorExpressions.h"
/** \class cmTargetLinkLibrariesCommand
* \brief Specify a list of libraries to link into executables.
......@@ -141,6 +142,12 @@ public:
"However, if two archives are really so interdependent they should "
"probably be combined into a single archive."
"Arguments to target_link_libraries may use \"generator expressions\" "
"with the syntax \"$<...>\". Note however, that generator expressions "
"will not be used in OLD handling of CMP0003 or CMP0004."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment