summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-18 12:58:48 +0200
committerBrad King <brad.king@kitware.com>2013-07-24 10:40:00 -0400
commit4f6bd7022bf670f9516c7b5e67c254d639425ab4 (patch)
tree710881681b38d86aa8801dabcce2895206c6f969 /Source
parentf82c751d7b3ee3907d780060985a36bdddcabad3 (diff)
downloadcmake-4f6bd7022bf670f9516c7b5e67c254d639425ab4.tar.gz
Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way to get the linker language of a particular target. TARGET_PROPERTY provides this flexibility and STREQUAL provides the necessary API for equality test. Extend the CompileDefinitions test to cover accessing the property of another target.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAddCompileOptionsCommand.h1
-rw-r--r--Source/cmDocumentGeneratorExpressions.h8
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx78
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Source/cmTarget.cxx25
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h1
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h1
7 files changed, 25 insertions, 92 deletions
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 45047957a2..e9bbf2816d 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -62,7 +62,6 @@ public:
"Arguments to add_compile_options may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 841061cd47..46cd77eaee 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -95,12 +95,4 @@
"the target on which the generator expression is evaluated.\n" \
""
-#define CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS \
- "Language related expressions:\n" \
- " $<LINK_LANGUAGE> = The link language of the target " \
- "being generated.\n" \
- " $<LINK_LANGUAGE:lang> = '1' if the link language of the " \
- "target being generated matches lang, else '0'.\n" \
- ""
-
#endif
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 381ef7c324..c1f53b4a24 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -573,69 +573,6 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
}
} configurationTestNode;
-//----------------------------------------------------------------------------
-static const struct LinkLanguageNode : public cmGeneratorExpressionNode
-{
- LinkLanguageNode() {}
-
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
-
- std::string Evaluate(const std::vector<std::string> &parameters,
- cmGeneratorExpressionContext *context,
- const GeneratorExpressionContent *content,
- 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)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> expression requires one or two parameters");
- return std::string();
- }
- cmTarget* target = context->HeadTarget;
- if (!target)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> may only be used with targets. It may not "
- "be used with add_custom_command.");
- return std::string();
- }
-
- const char *lang = target->GetLinkerLanguage(context->Config);
- if (parameters.size() == 0)
- {
- return lang ? lang : "";
- }
- else
- {
- cmsys::RegularExpression langValidator;
- langValidator.compile("^[A-Za-z0-9_]*$");
- if (!langValidator.find(parameters.begin()->c_str()))
- {
- reportError(context, content->GetOriginalExpression(),
- "Expression syntax not recognized.");
- return std::string();
- }
- if (!lang)
- {
- return parameters.front().empty() ? "1" : "0";
- }
-
- if (strcmp(parameters.begin()->c_str(), lang) == 0)
- {
- return "1";
- }
- return "0";
- }
- }
-} linkLanguageNode;
-
static const struct JoinNode : public cmGeneratorExpressionNode
{
JoinNode() {}
@@ -835,6 +772,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
assert(target);
+ if (propertyName == "LINKER_LANGUAGE")
+ {
+ if (dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "LINKER_LANGUAGE target property can not be used while evaluating "
+ "link libraries");
+ return std::string();
+ }
+ const char *lang = target->GetLinkerLanguage(context->Config);
+ return lang ? lang : "";
+ }
+
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
target->GetName(),
propertyName,
@@ -1380,8 +1330,6 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &configurationNode;
else if (identifier == "CONFIG")
return &configurationTestNode;
- else if (identifier == "LINK_LANGUAGE")
- return &linkLanguageNode;
else if (identifier == "TARGET_FILE")
return &targetFileNode;
else if (identifier == "TARGET_LINKER_FILE")
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 818a580a2e..2cd19cf2ea 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4087,8 +4087,7 @@ void cmMakefile::DefineProperties(cmake *cm)
"the options for the compiler.\n"
"Contents of COMPILE_OPTIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("LINK_DIRECTORIES", cmProperty::DIRECTORY,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 70500cdaf9..f8cecd11dd 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -292,7 +292,6 @@ void cmTarget::DefineProperties(cmake *cm)
"Contents of COMPILE_DEFINITIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
@@ -311,8 +310,7 @@ void cmTarget::DefineProperties(cmake *cm)
"the options for the compiler.\n"
"Contents of COMPILE_OPTIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_COMPILE_OPTIONS", cmProperty::TARGET,
@@ -323,8 +321,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_OPTIONS> to use the "
"compile options specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("DEFINE_SYMBOL", cmProperty::TARGET,
@@ -653,8 +650,7 @@ void cmTarget::DefineProperties(cmake *cm)
"See also the include_directories command.\n"
"Contents of INCLUDE_DIRECTORIES may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INSTALL_NAME_DIR", cmProperty::TARGET,
@@ -749,7 +745,11 @@ void cmTarget::DefineProperties(cmake *cm)
"file providing the program entry point (main). "
"If not set, the language with the highest linker preference "
"value is the default. "
- "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.");
+ "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables."
+ "\n"
+ "If this property is not set by the user, it will be calculated at "
+ "generate-time by CMake."
+ );
cm->DefineProperty
("LOCATION", cmProperty::TARGET,
@@ -870,8 +870,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES> to use the "
"include directories specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("SYSTEM_INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET,
@@ -881,8 +880,7 @@ void cmTarget::DefineProperties(cmake *cm)
"compiler warnings. Consuming targets will then mark the same include "
"directories as system headers."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_COMPILE_DEFINITIONS", cmProperty::TARGET,
@@ -893,8 +891,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_DEFINITIONS> to use the "
"compile definitions specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET,
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index bc58b3174b..585485d2a3 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -70,7 +70,6 @@ public:
"Arguments to target_compile_definitions may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 29686183cf..fcc37f06a7 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -83,7 +83,6 @@ public:
"Arguments to target_include_directories may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}