[Cmake-commits] CMake branch, master, updated. v3.11.0-347-g894a41f
Kitware Robot
kwrobot at kitware.com
Thu Mar 29 10:25:09 EDT 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via 894a41fc275b454e3d9da04b6e15244099269c74 (commit)
via 3272677e634629628a6293614fd169ff66d72e0d (commit)
via a03105ac8c821bd8a2fe269671b49862ae354db8 (commit)
via cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7 (commit)
via fd6c452986af2e85a259813aa01d90d454c28d4b (commit)
via 7b173a29332af37eb285d8cf5924a44be3a944dd (commit)
via ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268 (commit)
via 80767dd50e9898002253f383e9029dcc9da9f4c4 (commit)
from 08b49c277daa5e833a2ff4673c8dd1ab003eb8d9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=894a41fc275b454e3d9da04b6e15244099269c74
commit 894a41fc275b454e3d9da04b6e15244099269c74
Merge: 3272677 80767dd
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 29 14:23:58 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Mar 29 10:24:06 2018 -0400
Merge topic 'vs-simplify'
80767dd50e VS: Simplify XML code
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1895
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3272677e634629628a6293614fd169ff66d72e0d
commit 3272677e634629628a6293614fd169ff66d72e0d
Merge: a03105a 7b173a2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 29 14:21:36 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Mar 29 10:21:48 2018 -0400
Merge topic 'genex-TARGET_NAME_IF_EXISTS'
7b173a2933 genex: Add TARGET_NAME_IF_EXISTS expression
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1890
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a03105ac8c821bd8a2fe269671b49862ae354db8
commit a03105ac8c821bd8a2fe269671b49862ae354db8
Merge: cdc6dd8 fd6c452
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 29 14:16:55 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Mar 29 10:17:18 2018 -0400
Merge topic 'remove-unused-variable'
fd6c452986 cmTarget: Remove unused variable
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1898
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7
commit cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7
Merge: 08b49c2 ae1cbff
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 29 14:16:04 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Mar 29 10:16:27 2018 -0400
Merge topic 'gcov-warning-message'
ae1cbff07f CTest: The "Could not find gcov." message should not be a warning
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1894
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd6c452986af2e85a259813aa01d90d454c28d4b
commit fd6c452986af2e85a259813aa01d90d454c28d4b
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Mar 28 11:09:01 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 28 11:09:56 2018 -0400
cmTarget: Remove unused variable
Remove an unused variable and its containing local scope accidentally
left by commit v3.11.0-rc1~44^2 (Reduce allocation of temporary values
on heap, 2018-01-25).
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6137223..231bd3b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -721,12 +721,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
return;
}
- {
- cmTarget::LibraryID tmp;
- tmp.first = lib;
- tmp.second = llt;
- this->OriginalLinkLibraries.emplace_back(lib, llt);
- }
+ this->OriginalLinkLibraries.emplace_back(lib, llt);
// Add the explicit dependency information for libraries. This is
// simply a set of libraries separated by ";". There should always
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b173a29332af37eb285d8cf5924a44be3a944dd
commit 7b173a29332af37eb285d8cf5924a44be3a944dd
Author: Alex Turbov <i.zaufi at gmail.com>
AuthorDate: Tue Mar 27 04:57:44 2018 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 28 08:38:00 2018 -0400
genex: Add TARGET_NAME_IF_EXISTS expression
Define `$<TARGET_NAME_IF_EXISTS:tgt>` to mean `tgt` if the target
exists and otherwise an empty string.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index d3514ab..0e73bd2 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -274,6 +274,9 @@ Available output expressions are:
Marks ``...`` as being the name of a target. This is required if exporting
targets to multiple dependent export sets. The ``...`` must be a literal
name of a target- it may not contain generator expressions.
+``$<TARGET_NAME_IF_EXISTS:...>``
+ Expands to the ``...`` if the given target exists, an empty string
+ otherwise.
``$<LINK_ONLY:...>``
Content of ``...`` except when evaluated in a link interface while
propagating :ref:`Target Usage Requirements`, in which case it is the
diff --git a/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst b/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst
new file mode 100644
index 0000000..416e812
--- /dev/null
+++ b/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst
@@ -0,0 +1,6 @@
+genex-TARGET_NAME_IF_EXISTS
+---------------------------
+
+* A new ``$<TARGET_NAME_IF_EXISTS:...>``
+ :manual:`generator expression <cmake-generator-expressions(7)>`
+ has been added.
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f444113..09b7faf 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -331,6 +331,40 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode
}
} targetExistsNode;
+static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode
+{
+ TargetNameIfExistsNode() {}
+
+ int NumExpectedParameters() const override { return 1; }
+
+ std::string Evaluate(
+ const std::vector<std::string>& parameters,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
+ {
+ if (parameters.size() != 1) {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_NAME_IF_EXISTS:...> expression requires one "
+ "parameter");
+ return std::string();
+ }
+
+ std::string targetName = parameters.front();
+ if (targetName.empty() ||
+ !cmGeneratorExpression::IsValidTargetName(targetName)) {
+ reportError(context, content->GetOriginalExpression(),
+ "$<TARGET_NAME_IF_EXISTS:tgt> expression requires a "
+ "non-empty valid target name.");
+ return std::string();
+ }
+
+ return context->LG->GetMakefile()->FindTargetToUse(targetName)
+ ? targetName
+ : std::string();
+ }
+} targetNameIfExistsNode;
+
static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
@@ -1897,6 +1931,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
nodeMap["TARGET_OBJECTS"] = &targetObjectsNode;
nodeMap["TARGET_POLICY"] = &targetPolicyNode;
nodeMap["TARGET_EXISTS"] = &targetExistsNode;
+ nodeMap["TARGET_NAME_IF_EXISTS"] = &targetNameIfExistsNode;
nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode;
nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode;
nodeMap["INSTALL_PREFIX"] = &installPrefixNode;
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index f9a5cae..5636d00 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -38,6 +38,10 @@ run_cmake(TARGET_EXISTS-no-arg)
run_cmake(TARGET_EXISTS-empty-arg)
run_cmake(TARGET_EXISTS)
run_cmake(TARGET_EXISTS-not-a-target)
+run_cmake(TARGET_NAME_IF_EXISTS-no-arg)
+run_cmake(TARGET_NAME_IF_EXISTS-empty-arg)
+run_cmake(TARGET_NAME_IF_EXISTS)
+run_cmake(TARGET_NAME_IF_EXISTS-not-a-target)
run_cmake(ImportedTarget-TARGET_BUNDLE_DIR)
run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake
new file mode 100644
index 0000000..2f57430
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated.txt" content)
+
+set(expected "foo")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt
new file mode 100644
index 0000000..5ee13b7
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at TARGET_NAME_IF_EXISTS-empty-arg.cmake:2 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_NAME_IF_EXISTS:>
+
+ \$<TARGET_NAME_IF_EXISTS:tgt> expression requires a non-empty valid target
+ name.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake
new file mode 100644
index 0000000..f5034f4
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0070 NEW)
+file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:${empty}>")
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt
new file mode 100644
index 0000000..4122425
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at TARGET_NAME_IF_EXISTS-no-arg.cmake:2 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_NAME_IF_EXISTS>
+
+ \$<TARGET_NAME_IF_EXISTS> expression requires exactly one parameter.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake
new file mode 100644
index 0000000..3293094
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0070 NEW)
+file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS>")
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake
new file mode 100644
index 0000000..2085c16
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake
@@ -0,0 +1,5 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-not-a-target-generated.txt" content)
+
+if(content)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected an empty string")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake
new file mode 100644
index 0000000..a054e6c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0070 NEW)
+file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-not-a-target-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:just-random-string>")
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake
new file mode 100644
index 0000000..0ce3b1d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0070 NEW)
+add_custom_target(foo)
+file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$<TARGET_NAME_IF_EXISTS:foo>")
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268
commit ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268
Author: Betsy McPhail <betsy.mcphail at kitware.com>
AuthorDate: Tue Mar 27 14:59:58 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 28 08:32:46 2018 -0400
CTest: The "Could not find gcov." message should not be a warning
It now matches the log level of other coverage messages.
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 6cf0ac2..bafbe9a 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -928,7 +928,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::string gcovCommand =
this->CTest->GetCTestConfiguration("CoverageCommand");
if (gcovCommand.empty()) {
- cmCTestLog(this->CTest, WARNING, "Could not find gcov." << std::endl);
+ cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Could not find gcov." << std::endl, this->Quiet);
return 0;
}
std::string gcovExtraFlags =
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80767dd50e9898002253f383e9029dcc9da9f4c4
commit 80767dd50e9898002253f383e9029dcc9da9f4c4
Author: Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Tue Mar 27 17:39:19 2018 -0400
Commit: Vitaly Stakhovsky <vvs31415 at gitlab.org>
CommitDate: Tue Mar 27 17:39:19 2018 -0400
VS: Simplify XML code
Get rid of suffix arguments
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index c7bb38c..91ee09f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -792,10 +792,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
<< "\\$(ConfigurationName)\"\n";
}
targetOptions.OutputAdditionalIncludeDirectories(
- fout, "\t\t\t\t", "\n",
- this->FortranProject ? "Fortran" : langForClCompile);
+ fout, "\t\t\t\t", this->FortranProject ? "Fortran" : langForClCompile);
targetOptions.OutputFlagMap(fout, "\t\t\t\t");
- targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
+ targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t",
langForClCompile);
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
@@ -815,11 +814,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
"\t\t\t\tName=\"MASM\"\n"
;
/* clang-format on */
- targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "\n",
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t",
"ASM_MASM");
// Use same preprocessor definitions as VCCLCompilerTool.
- targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
- "ASM_MASM");
+ targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "ASM_MASM");
masmOptions.OutputFlagMap(fout, "\t\t\t\t");
/* clang-format off */
fout <<
@@ -837,18 +835,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
tool = "VFResourceCompilerTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
- targetOptions.OutputAdditionalIncludeDirectories(fout, "\n\t\t\t\t", "",
- "RC");
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "RC");
// add the -D flags to the RC tool
- targetOptions.OutputPreprocessorDefinitions(fout, "\n\t\t\t\t", "", "RC");
- fout << "/>\n";
+ targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "RC");
+ fout << "\t\t\t/>\n";
tool = "VCMIDLTool";
if (this->FortranProject) {
tool = "VFMIDLTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
- targetOptions.OutputAdditionalIncludeDirectories(fout, "\n\t\t\t\t", "",
- "MIDL");
+ targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "MIDL");
fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n";
if (gg->GetPlatformName() == "x64") {
fout << "\t\t\t\tTargetEnvironment=\"3\"\n";
@@ -1686,9 +1682,9 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
fileOptions.AddIncludes(includes);
fileOptions.OutputFlagMap(fout, "\t\t\t\t\t");
fileOptions.OutputAdditionalIncludeDirectories(
- fout, "\t\t\t\t\t", "\n",
+ fout, "\t\t\t\t\t",
ppLang == "CXX" && this->FortranProject ? "Fortran" : ppLang);
- fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", "\n",
+ fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t",
ppLang);
}
if (!fc.AdditionalDeps.empty()) {
@@ -2071,7 +2067,7 @@ void cmVS7GeneratorOptions::OutputFlag(std::ostream& fout, const char* indent,
{
fout << indent << tag << "=\"";
fout << cmLocalVisualStudio7GeneratorEscapeForXML(content);
- fout << "\"";
+ fout << "\"\n";
}
// This class is used to parse an existing vs 7 project
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f1aed88..4bd07ef 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -86,12 +86,12 @@ public:
// use the configuration specific tag for PreprocessorDefinitions
fout << indent;
this->TargetGenerator->WritePlatformConfigTag(
- tag, this->GetConfiguration(), 0, 0, 0, &fout);
+ tag, this->GetConfiguration(), 0);
} else {
fout << indent << "<" << tag << ">";
}
fout << cmVS10EscapeXML(content);
- fout << "</" << tag << ">";
+ fout << "</" << tag << ">\n";
}
private:
@@ -218,12 +218,10 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
const char* tag, const std::string& config, int indentLevel,
- const char* attribute, const char* end, std::ostream* stream)
+ const char* attribute)
{
- if (!stream) {
- stream = this->BuildFileStream;
- }
+ std::ostream* stream = this->BuildFileStream;
stream->fill(' ');
stream->width(indentLevel * 2);
(*stream) << ""; // applies indentation
@@ -244,8 +242,8 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
}
// close the tag
(*stream) << ">";
- if (end) {
- (*stream) << end;
+ if (attribute) {
+ (*stream) << "\n";
}
}
@@ -972,7 +970,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
for (std::string const& c : this->Configurations) {
this->WritePlatformConfigTag("PropertyGroup", c, 1,
- " Label=\"Configuration\"", "\n");
+ " Label=\"Configuration\"");
if (this->ProjectType != csproj) {
std::string configType = "<ConfigurationType>";
@@ -1312,8 +1310,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp(
attributes << "\n Name=\"" << name << "\"";
attributes << "\n Inputs=\"" << inputs << "\"";
attributes << "\n Outputs=\"" << outputs << "\"";
- this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str(),
- "\n");
+ this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str());
if (!comment.empty()) {
this->WriteString("<Exec Command=\"", 2);
(*this->BuildFileStream) << "echo " << cmVS10EscapeXML(comment)
@@ -2127,10 +2124,10 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
clOptions.SetConfiguration(config);
clOptions.PrependInheritedString("AdditionalOptions");
clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
- " ", "\n", lang);
+ " ", lang);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", lang);
+ lang);
}
}
if (this->IsXamlSource(source->GetFullPath())) {
@@ -2486,10 +2483,10 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
this->WriteString("<ClCompile>\n", 2);
clOptions.PrependInheritedString("AdditionalOptions");
clOptions.OutputAdditionalIncludeDirectories(
- *this->BuildFileStream, " ", "\n", this->LangForClCompile);
+ *this->BuildFileStream, " ", this->LangForClCompile);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", this->LangForClCompile);
+ this->LangForClCompile);
if (this->NsightTegra) {
if (const char* processMax =
@@ -2575,9 +2572,9 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions(
Options& rcOptions = *(this->RcOptions[configName]);
rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "RC");
+ "RC");
rcOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
- " ", "\n", "RC");
+ " ", "RC");
rcOptions.PrependInheritedString("AdditionalOptions");
rcOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -2711,9 +2708,9 @@ void cmVisualStudio10TargetGenerator::WriteCudaOptions(
Options& cudaOptions = *(this->CudaOptions[configName]);
cudaOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
- " ", "\n", "CUDA");
+ " ", "CUDA");
cudaOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "CUDA");
+ "CUDA");
cudaOptions.PrependInheritedString("AdditionalOptions");
cudaOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -2836,11 +2833,11 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions(
// Preprocessor definitions and includes are shared with clOptions.
Options& clOptions = *(this->ClOptions[configName]);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "ASM_MASM");
+ "ASM_MASM");
Options& masmOptions = *(this->MasmOptions[configName]);
masmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
- " ", "\n", "ASM_MASM");
+ " ", "ASM_MASM");
masmOptions.PrependInheritedString("AdditionalOptions");
masmOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -2897,16 +2894,16 @@ void cmVisualStudio10TargetGenerator::WriteNasmOptions(
this->GetIncludes(configName, "ASM_NASM");
Options& nasmOptions = *(this->NasmOptions[configName]);
nasmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
- " ", "\n", "ASM_NASM");
+ " ", "ASM_NASM");
nasmOptions.OutputFlagMap(*this->BuildFileStream, " ");
nasmOptions.PrependInheritedString("AdditionalOptions");
nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "ASM_NASM");
+ "ASM_NASM");
// Preprocessor definitions and includes are shared with clOptions.
Options& clOptions = *(this->ClOptions[configName]);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
- "\n", "ASM_NASM");
+ "ASM_NASM");
this->WriteString("</NASM>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 87f735d..7106737 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -34,8 +34,7 @@ public:
void Generate();
// used by cmVisualStudioGeneratorOptions
void WritePlatformConfigTag(const char* tag, const std::string& config,
- int indentLevel, const char* attribute = 0,
- const char* end = 0, std::ostream* strm = 0);
+ int indentLevel, const char* attribute = 0);
private:
struct ToolSource
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 26fce4b..8b6f057 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -422,8 +422,7 @@ const std::string& cmVisualStudioGeneratorOptions::GetConfiguration() const
}
void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
- std::ostream& fout, const char* prefix, const char* suffix,
- const std::string& lang)
+ std::ostream& fout, const char* prefix, const std::string& lang)
{
if (this->Defines.empty()) {
return;
@@ -462,12 +461,10 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
}
this->OutputFlag(fout, prefix, tag, oss.str());
- fout << suffix;
}
void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
- std::ostream& fout, const char* prefix, const char* suffix,
- const std::string& lang)
+ std::ostream& fout, const char* prefix, const std::string& lang)
{
if (this->Includes.empty()) {
return;
@@ -512,7 +509,6 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
}
this->OutputFlag(fout, prefix, tag, oss.str());
- fout << suffix;
}
void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
@@ -530,6 +526,5 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
}
this->OutputFlag(fout, indent, m.first.c_str(), oss.str());
- fout << "\n";
}
}
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 40290d1..974ca62 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -78,11 +78,9 @@ public:
bool IsManaged() const;
// Write options to output.
void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix,
- const char* suffix,
const std::string& lang);
void OutputAdditionalIncludeDirectories(std::ostream& fout,
const char* prefix,
- const char* suffix,
const std::string& lang);
void OutputFlagMap(std::ostream& fout, const char* indent);
void SetConfiguration(const std::string& config);
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-generator-expressions.7.rst | 3 ++
Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst | 6 +++
Source/CTest/cmCTestCoverageHandler.cxx | 3 +-
Source/cmGeneratorExpressionNode.cxx | 35 +++++++++++++++
Source/cmLocalVisualStudio7Generator.cxx | 26 +++++------
Source/cmTarget.cxx | 7 +--
Source/cmVisualStudio10TargetGenerator.cxx | 45 +++++++++-----------
Source/cmVisualStudio10TargetGenerator.h | 3 +-
Source/cmVisualStudioGeneratorOptions.cxx | 9 +---
Source/cmVisualStudioGeneratorOptions.h | 2 -
.../GeneratorExpression/RunCMakeTest.cmake | 4 ++
...eck.cmake => TARGET_NAME_IF_EXISTS-check.cmake} | 4 +-
.../TARGET_NAME_IF_EXISTS-empty-arg-result.txt} | 0
.../TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt | 9 ++++
.../TARGET_NAME_IF_EXISTS-empty-arg.cmake | 2 +
.../TARGET_NAME_IF_EXISTS-no-arg-result.txt} | 0
.../TARGET_NAME_IF_EXISTS-no-arg-stderr.txt | 8 ++++
.../TARGET_NAME_IF_EXISTS-no-arg.cmake | 2 +
.../TARGET_NAME_IF_EXISTS-not-a-target-check.cmake | 5 +++
.../TARGET_NAME_IF_EXISTS-not-a-target.cmake | 2 +
.../TARGET_NAME_IF_EXISTS.cmake | 3 ++
21 files changed, 119 insertions(+), 59 deletions(-)
create mode 100644 Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst
copy Tests/RunCMake/GeneratorExpression/{TARGET_EXISTS-check.cmake => TARGET_NAME_IF_EXISTS-check.cmake} (56%)
copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt} (100%)
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake
copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt} (100%)
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake
create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list