summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0057.rst21
-rw-r--r--Help/release/dev/main_dependency_diagnostic.rst6
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx1
-rw-r--r--Source/CTest/cmParseJacocoCoverage.cxx5
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx1
-rw-r--r--Source/cmAlgorithms.h50
-rw-r--r--Source/cmCTest.cxx1
-rw-r--r--Source/cmComputeLinkDepends.cxx1
-rw-r--r--Source/cmComputeLinkInformation.cxx1
-rw-r--r--Source/cmCoreTryCompile.cxx1
-rw-r--r--Source/cmDependsC.cxx1
-rw-r--r--Source/cmDocumentation.cxx1
-rw-r--r--Source/cmExportFileGenerator.cxx1
-rw-r--r--Source/cmExportInstallFileGenerator.cxx1
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmFindBase.cxx2
-rw-r--r--Source/cmFindPackageCommand.cxx1
-rw-r--r--Source/cmGeneratorExpression.cxx1
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx1
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx1
-rw-r--r--Source/cmGeneratorTarget.cxx1
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx18
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx1
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx1
-rw-r--r--Source/cmInstalledFile.cxx11
-rw-r--r--Source/cmInstalledFile.h12
-rw-r--r--Source/cmListCommand.cxx1
-rw-r--r--Source/cmLocalGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx1
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx7
-rw-r--r--Source/cmMacroCommand.cxx1
-rw-r--r--Source/cmMakeDepend.cxx1
-rw-r--r--Source/cmMakefile.cxx28
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx1
-rw-r--r--Source/cmOrderDirectories.cxx1
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx1
-rw-r--r--Source/cmPolicies.cxx6
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmQtAutoGenerators.cxx1
-rw-r--r--Source/cmSearchPath.cxx1
-rw-r--r--Source/cmSourceFileLocation.cxx1
-rw-r--r--Source/cmTarget.cxx1
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.cxx2
-rw-r--r--Source/cmTargetCompileFeaturesCommand.cxx2
-rw-r--r--Source/cmTargetCompileOptionsCommand.cxx2
-rw-r--r--Source/cmake.cxx1
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/cmcmd.cxx1
-rw-r--r--Source/kwsys/hashtable.hxx.in2
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in (renamed from Tests/JacocoCoverage/Coverage/target/site/jacoco.xml)0
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-NEW.cmake13
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-OLD.cmake13
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-WARN.cmake11
-rw-r--r--Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake8
-rw-r--r--Tests/RunCMake/CMP0057/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0057/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CMP0057/input.txt0
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
69 files changed, 265 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1250a94775..d86ae96cc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,10 +37,10 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
endif()
# Use most-recent available language dialects with GNU and Clang
-if(NOT DEFINED CMAKE_C_STANDARD)
+if(NOT DEFINED CMAKE_C_STANDARD AND NOT CMake_NO_C_STANDARD)
set(CMAKE_C_STANDARD 11)
endif()
-if(NOT DEFINED CMAKE_CXX_STANDARD)
+if(NOT DEFINED CMAKE_CXX_STANDARD AND NOT CMake_NO_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 96f39e66ed..76ca5d4edf 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -114,3 +114,4 @@ All Policies
/policy/CMP0054
/policy/CMP0055
/policy/CMP0056
+ /policy/CMP0057
diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst
new file mode 100644
index 0000000000..5cf078470f
--- /dev/null
+++ b/Help/policy/CMP0057.rst
@@ -0,0 +1,21 @@
+CMP0057
+-------
+
+Disallow multiple ``MAIN_DEPENDENCY`` specifications for the same file.
+
+CMake 3.3 and above no longer allow the same input file to be used
+as a ``MAIN_DEPENDENCY`` in more than one custom command.
+
+Listing the same input file more than once in this context has not been
+supported by earlier versions either and would lead to build time issues
+but was not diagnosed.
+
+The ``OLD`` behavior for this policy is to allow using the same input file
+in a ``MAIN_DEPENDENCY`` specfication more than once.
+The ``NEW`` behavior is to disallow using the same input file in a
+``MAIN_DEPENDENCY`` specification more than once.
+
+This policy was introduced in CMake version 3.3.
+CMake version |release| warns when the policy is not set and uses
+``OLD`` behavior. Use the :command:`cmake_policy` command to set
+it to ``OLD`` or ``NEW`` explicitly.
diff --git a/Help/release/dev/main_dependency_diagnostic.rst b/Help/release/dev/main_dependency_diagnostic.rst
new file mode 100644
index 0000000000..13486efd53
--- /dev/null
+++ b/Help/release/dev/main_dependency_diagnostic.rst
@@ -0,0 +1,6 @@
+main_dependency_diagnostic
+--------------------------
+
+* Listing the same input file as a MAIN_DEPENDENCY of a custom command
+ can lead to broken build time behavior. This is now diagnosed.
+ See policy :policy:`CMP0057`.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8fcdac9972..ca664785e3 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 2)
-set(CMake_VERSION_PATCH 20150310)
+set(CMake_VERSION_PATCH 20150312)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index fe27e2b3c9..29e07ef4cb 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -20,6 +20,7 @@
#include "cmGeneratedFileStream.h"
#include "cmXMLSafe.h"
#include "cmFileTimeComparison.h"
+#include "cmAlgorithms.h"
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx
index ec4cfadd63..31ad9febcd 100644
--- a/Source/CTest/cmParseJacocoCoverage.cxx
+++ b/Source/CTest/cmParseJacocoCoverage.cxx
@@ -78,7 +78,10 @@ class cmParseJacocoCoverage::XMLParser: public cmXMLParser
std::string line;
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
- curFileLines.push_back(-1);
+ if(fin)
+ {
+ curFileLines.push_back(-1);
+ }
while(cmSystemTools::GetLineFromStream(fin, line))
{
curFileLines.push_back(-1);
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index dcd0b6cd42..d60062e5bb 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -22,6 +22,7 @@
#include "cmCursesDummyWidget.h"
#include "cmCursesCacheEntryComposite.h"
#include "cmCursesLongMessageForm.h"
+#include "cmAlgorithms.h"
inline int ctrl(int z)
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index b9d7e7889a..f117475e92 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -237,6 +237,11 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
{
typename InputRange::const_iterator remIt = rem.begin();
typename InputRange::const_iterator remEnd = rem.end();
+ const typename Range::iterator rangeEnd = r.end();
+ if (remIt == remEnd)
+ {
+ return rangeEnd;
+ }
typename Range::iterator writer = r.begin();
std::advance(writer, *remIt);
@@ -244,7 +249,6 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
typename InputRange::value_type prevRem = *remIt;
++remIt;
size_t count = 1;
- const typename Range::iterator rangeEnd = r.end();
for ( ; writer != rangeEnd && remIt != remEnd; ++count, ++remIt)
{
std::advance(pivot, *remIt - prevRem);
@@ -261,23 +265,53 @@ typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m)
ContainerAlgorithms::BinarySearcher<MatchRange>(m));
}
+namespace ContainerAlgorithms {
+
+template<typename Range, typename T = typename Range::value_type>
+struct RemoveDuplicatesAPI
+{
+ typedef typename Range::const_iterator const_iterator;
+ typedef typename Range::const_iterator value_type;
+
+ static bool lessThan(value_type a, value_type b) { return *a < *b; }
+ static value_type uniqueValue(const_iterator a) { return a; }
+ template<typename It>
+ static bool valueCompare(It it, const_iterator it2) { return **it != *it2; }
+};
+
+template<typename Range, typename T>
+struct RemoveDuplicatesAPI<Range, T*>
+{
+ typedef typename Range::const_iterator const_iterator;
+ typedef T* value_type;
+
+ static bool lessThan(value_type a, value_type b) { return a < b; }
+ static value_type uniqueValue(const_iterator a) { return *a; }
+ template<typename It>
+ static bool valueCompare(It it, const_iterator it2) { return *it != *it2; }
+};
+
+}
+
template<typename Range>
typename Range::const_iterator cmRemoveDuplicates(Range& r)
{
- typedef std::vector<typename Range::value_type> UniqueVector;
- UniqueVector unique;
+ typedef typename ContainerAlgorithms::RemoveDuplicatesAPI<Range> API;
+ typedef typename API::value_type T;
+ std::vector<T> unique;
unique.reserve(r.size());
std::vector<size_t> indices;
size_t count = 0;
- const typename Range::iterator end = r.end();
+ const typename Range::const_iterator end = r.end();
for(typename Range::const_iterator it = r.begin();
it != end; ++it, ++count)
{
- const typename UniqueVector::iterator low =
- std::lower_bound(unique.begin(), unique.end(), *it);
- if (low == unique.end() || *low != *it)
+ const typename std::vector<T>::iterator low =
+ std::lower_bound(unique.begin(), unique.end(),
+ API::uniqueValue(it), API::lessThan);
+ if (low == unique.end() || API::valueCompare(low, it))
{
- unique.insert(low, *it);
+ unique.insert(low, API::uniqueValue(it));
}
else
{
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index e6d396032d..1d0df69202 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -26,6 +26,7 @@
#include "cmVersionMacros.h"
#include "cmCTestCommand.h"
#include "cmCTestStartCommand.h"
+#include "cmAlgorithms.h"
#include "cmCTestBuildHandler.h"
#include "cmCTestBuildAndTestHandler.h"
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index be28b2f54a..6005d5fe50 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -17,6 +17,7 @@
#include "cmMakefile.h"
#include "cmTarget.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
#include <cmsys/stl/algorithm>
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 479da75f7d..b0e0f36c32 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -19,6 +19,7 @@
#include "cmMakefile.h"
#include "cmTarget.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
#include <ctype.h>
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index e9390e430f..59efa52d96 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -14,6 +14,7 @@
#include "cmCacheManager.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
+#include "cmAlgorithms.h"
#include "cmExportTryCompileFileGenerator.h"
#include <cmsys/Directory.hxx>
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 6dde3494ec..63d8fa6b34 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -15,6 +15,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#include <cmsys/FStream.hxx>
#include <ctype.h> // isspace
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index f4e3a75f7c..8c17536a8c 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -14,6 +14,7 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmRST.h"
+#include "cmAlgorithms.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 71728be260..b4fad98883 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -22,6 +22,7 @@
#include "cmTargetExport.h"
#include "cmVersion.h"
#include "cmComputeLinkInformation.h"
+#include "cmAlgorithms.h"
#include <cmsys/auto_ptr.hxx>
#include <cmsys/FStream.hxx>
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index ba1dde29f6..6d639c9acd 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmTargetExport.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmExportInstallFileGenerator
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 0290c923cc..ec22ea0a5b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -16,6 +16,7 @@
#include "cmInstallType.h"
#include "cmFileTimeComparison.h"
#include "cmCryptoHash.h"
+#include "cmAlgorithms.h"
#include "cmTimestamp.h"
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index ffc641cf98..f63df616d2 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmFindBase.h"
+#include "cmAlgorithms.h"
+
cmFindBase::cmFindBase()
{
this->AlreadyInCache = false;
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 26bd4b98e1..87f903718e 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -14,6 +14,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Encoding.hxx>
+#include "cmAlgorithms.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmVariableWatch.h"
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 2d795cbb6c..a1c405b007 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmTarget.h"
#include "assert.h"
+#include "cmAlgorithms.h"
#include "cmGeneratorExpressionEvaluator.h"
#include "cmGeneratorExpressionLexer.h"
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index c8b9949c03..ff8790c936 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index f2ffeefc35..af94bcc695 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -18,6 +18,7 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmSourceFile.h"
+#include "cmAlgorithms.h"
#include <cmsys/String.h>
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b7b2effc45..e0af47a2f5 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -20,6 +20,7 @@
#include "cmGeneratorExpressionDAGChecker.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
+#include "cmAlgorithms.h"
#include <queue>
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index fd18596920..85aa31fbf0 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -14,6 +14,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
// cmGetCMakePropertyCommand
bool cmGetCMakePropertyCommand
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 36395aa67e..8123c99413 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -32,6 +32,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmExportBuildFileGenerator.h"
#include "cmCPackPropertiesGenerator.h"
+#include "cmAlgorithms.h"
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
@@ -1717,6 +1718,19 @@ int cmGlobalGenerator::Build(
std::string outputBuffer;
std::string* outputPtr = &outputBuffer;
+ std::vector<std::string> makeCommand;
+ this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
+ bindir, target, config, fast, verbose,
+ nativeOptions);
+
+ // Workaround to convince VCExpress.exe to produce output.
+ if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH &&
+ !makeCommand.empty() && cmSystemTools::LowerCase(
+ cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe")
+ {
+ outputflag = cmSystemTools::OUTPUT_NORMAL;
+ }
+
// should we do a clean first?
if (clean)
{
@@ -1743,10 +1757,6 @@ int cmGlobalGenerator::Build(
}
// now build
- std::vector<std::string> makeCommand;
- this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
- bindir, target, config, fast, verbose,
- nativeOptions);
std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand);
output += "\nRun Build Command:";
output += makeCommandStr;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 5701564346..7648813a36 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -18,6 +18,7 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmGeneratorTarget.h"
+#include "cmAlgorithms.h"
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
{
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 7df2073324..18d40e1dae 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -17,6 +17,7 @@
#include "cmVisualStudioSlnData.h"
#include "cmVisualStudioSlnParser.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
static const char vs10generatorName[] = "Visual Studio 10 2010";
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 3013200367..ed828b64c1 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalVisualStudio11Generator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
static const char vs11generatorName[] = "Visual Studio 11 2012";
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 2bc9379acb..c2e6f47a88 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalVisualStudio12Generator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
static const char vs12generatorName[] = "Visual Studio 12 2013";
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index fe702c06cf..b551c65187 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalVisualStudio14Generator.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
static const char vs14generatorName[] = "Visual Studio 14 2015";
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 4b53752b4f..8c52b488cb 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -12,6 +12,7 @@
#include "cmInstalledFile.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmInstalledFile::cmInstalledFile():
@@ -29,6 +30,16 @@ cmInstalledFile::~cmInstalledFile()
}
}
+cmInstalledFile::Property::Property()
+{
+
+}
+
+cmInstalledFile::Property::~Property()
+{
+ cmDeleteAll(this->ValueExpressions);
+}
+
//----------------------------------------------------------------------------
void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name)
{
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index cdb0866b4c..3af90a7dbe 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -13,7 +13,6 @@
#define cmInstalledFile_h
#include "cmGeneratorExpression.h"
-#include "cmAlgorithms.h"
/** \class cmInstalledFile
* \brief Represents a file intended for installation.
@@ -32,15 +31,8 @@ public:
struct Property
{
- Property()
- {
-
- }
-
- ~Property()
- {
- cmDeleteAll(this->ValueExpressions);
- }
+ Property();
+ ~Property();
ExpressionVectorType ValueExpressions;
};
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 17617aae86..d18269d33e 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -12,6 +12,7 @@
#include "cmListCommand.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
+#include "cmAlgorithms.h"
#include <stdlib.h> // required for atoi
#include <ctype.h>
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 37cc2c6626..e1998e4207 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -25,6 +25,7 @@
#include "cmCustomCommandGenerator.h"
#include "cmVersion.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# define CM_LG_ENCODE_OBJECT_NAMES
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 555007059e..8938e67d86 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -20,6 +20,7 @@
#include "cmVersion.h"
#include "cmFileTimeComparison.h"
#include "cmCustomCommandGenerator.h"
+#include "cmAlgorithms.h"
// Include dependency scanners for supported languages. Only the
// C/C++ scanner is needed for bootstrapping CMake.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index f53f825582..c4abeb2dd9 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -391,6 +391,13 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranFlagTable[] =
{"OptimizeForProcessor", "QxT", "", "codeExclusivelyCore2Duo", 0},
{"OptimizeForProcessor", "QxO", "", "codeExclusivelyCore2StreamingSIMD", 0},
{"OptimizeForProcessor", "QxS", "", "codeExclusivelyCore2StreamingSIMD4", 0},
+ {"OpenMP", "Qopenmp", "", "OpenMPParallelCode", 0},
+ {"OpenMP", "Qopenmp-stubs", "", "OpenMPSequentialCode", 0},
+ {"Traceback", "traceback", "", "true", 0},
+ {"Traceback", "notraceback", "", "false", 0},
+ {"FloatingPointExceptionHandling", "fpe:0", "", "fpe0", 0},
+ {"FloatingPointExceptionHandling", "fpe:1", "", "fpe1", 0},
+ {"FloatingPointExceptionHandling", "fpe:3", "", "fpe3", 0},
{"ModulePath", "module:", "", "",
cmVS7FlagTable::UserValueRequired},
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 12c8576fd8..b7cbae6e3e 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -12,6 +12,7 @@
#include "cmMacroCommand.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
// define the class for macro commands
class cmMacroHelperCommand : public cmCommand
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 31bbb738be..a6d4e58aa3 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -12,6 +12,7 @@
#include "cmMakeDepend.h"
#include "cmSystemTools.h"
#include "cmGeneratorExpression.h"
+#include "cmAlgorithms.h"
#include <cmsys/RegularExpression.hxx>
#include <cmsys/FStream.hxx>
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ccfe2b1e13..eeb9c7200e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -30,6 +30,7 @@
#include "cmInstallGenerator.h"
#include "cmTestGenerator.h"
#include "cmDefinitions.h"
+#include "cmAlgorithms.h"
#include "cmake.h"
#include <stdlib.h> // required for atoi
@@ -985,6 +986,33 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
}
else
{
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ bool issueMessage = false;
+
+ switch(this->GetPolicyStatus(cmPolicies::CMP0057))
+ {
+ case cmPolicies::WARN:
+ e << (this->GetPolicies()->
+ GetPolicyWarning(cmPolicies::CMP0057)) << "\n";
+ issueMessage = true;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
+ break;
+ }
+
+ if(issueMessage)
+ {
+ e << "\"" << main_dependency << "\" can only be specified as a "
+ "custom command MAIN_DEPENDENCY once.";
+ IssueMessage(messageType, e.str());
+ }
+
// The existing custom command is different. We need to
// generate a rule file for this new command.
file = 0;
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index c352c1a59e..155a30e44d 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmOSXBundleGenerator.h"
#include "cmGeneratorTarget.h"
#include "cmCustomCommandGenerator.h"
+#include "cmAlgorithms.h"
#include <assert.h>
#include <algorithm>
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 23f852606e..a612437031 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -14,6 +14,7 @@
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
#include <assert.h>
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 5016493bd6..df531e7b56 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmOutputRequiredFilesCommand.h"
#include "cmMakeDepend.h"
+#include "cmAlgorithms.h"
#include <cmsys/FStream.hxx>
class cmLBDepend : public cmMakeDepend
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3a48101254..720030bb84 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -4,6 +4,7 @@
#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmVersionMacros.h"
+#include "cmAlgorithms.h"
#include <map>
#include <set>
#include <queue>
@@ -374,6 +375,11 @@ cmPolicies::cmPolicies()
CMP0056, "CMP0056",
"Honor link flags in try_compile() source-file signature.",
3,2,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0057, "CMP0057",
+ "Disallow multiple MAIN_DEPENDENCY specifications for the same file.",
+ 3,3,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index c393c2f70f..854b132c80 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -113,6 +113,8 @@ public:
/// or keywords when unquoted.
CMP0055, ///< Strict checking for break() command.
CMP0056, ///< Honor link flags in try_compile() source-file signature.
+ CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications
+ /// for the same file.
/** \brief Always the last entry.
*
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 844d70870c..42c18f7da9 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -16,6 +16,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
# include "cmLocalVisualStudioGenerator.h"
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index 1e777ab7aa..045c82e5fe 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -12,6 +12,7 @@
#include "cmSearchPath.h"
#include "cmFindCommon.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmSearchPath::cmSearchPath(cmFindCommon* findCmd)
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index b81951dac9..9d67c1e645 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -15,6 +15,7 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#include "assert.h"
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7a6ad8b4fc..b70f60d6a0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -19,6 +19,7 @@
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmAlgorithms.h"
#include <cmsys/RegularExpression.hxx>
#include <map>
#include <set>
diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx
index dc19720cb8..394a166277 100644
--- a/Source/cmTargetCompileDefinitionsCommand.cxx
+++ b/Source/cmTargetCompileDefinitionsCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmTargetCompileDefinitionsCommand.h"
+#include "cmAlgorithms.h"
+
bool cmTargetCompileDefinitionsCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx
index 6ebc31e1eb..823afa1bd9 100644
--- a/Source/cmTargetCompileFeaturesCommand.cxx
+++ b/Source/cmTargetCompileFeaturesCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmTargetCompileFeaturesCommand.h"
+#include "cmAlgorithms.h"
+
bool cmTargetCompileFeaturesCommand::InitialPass(
std::vector<std::string> const& args,
cmExecutionStatus &)
diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx
index 8c6fc06220..a85153dd50 100644
--- a/Source/cmTargetCompileOptionsCommand.cxx
+++ b/Source/cmTargetCompileOptionsCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmTargetCompileOptionsCommand.h"
+#include "cmAlgorithms.h"
+
bool cmTargetCompileOptionsCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 80e90a8cb8..11196e4224 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -20,6 +20,7 @@
#include "cmSourceFile.h"
#include "cmTest.h"
#include "cmDocumentationFormatter.h"
+#include "cmAlgorithms.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGraphVizWriter.h"
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e0bd55bb28..ac73ad079b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -24,6 +24,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmAlgorithms.h"
#include <cmsys/Encoding.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 7d67bd82a0..9f2ea46361 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -15,6 +15,7 @@
#include "cmGlobalGenerator.h"
#include "cmQtAutoGenerators.h"
#include "cmVersion.h"
+#include "cmAlgorithms.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in
index 307f6bc1f9..7e7dc4259a 100644
--- a/Source/kwsys/hashtable.hxx.in
+++ b/Source/kwsys/hashtable.hxx.in
@@ -423,7 +423,7 @@ static const unsigned long _stl_prime_list[_stl_num_primes] =
return &_stl_prime_list[0]; }
-inline size_t _stl_next_prime(size_t __n)
+static inline size_t _stl_next_prime(size_t __n)
{
const unsigned long* __first = get_stl_prime_list();
const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 08765de85f..703c54823b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2409,6 +2409,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
"${CMake_BINARY_DIR}/Testing/JacocoCoverage/DartConfiguration.tcl")
file(COPY "${CMake_SOURCE_DIR}/Tests/JacocoCoverage/Coverage"
DESTINATION "${CMake_BINARY_DIR}/Testing/JacocoCoverage")
+ configure_file("${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml.in"
+ "${CMake_BINARY_DIR}/Testing/JacocoCoverage/Coverage/target/site/jacoco.xml")
add_test(NAME CTestJacocoCoverage
COMMAND cmake -E chdir
${CMake_BINARY_DIR}/Testing/JacocoCoverage
diff --git a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in
index 49c3e87409..49c3e87409 100644
--- a/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml
+++ b/Tests/JacocoCoverage/Coverage/target/site/jacoco.xml.in
diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt
new file mode 100644
index 0000000000..9607d5460f
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-NEW-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0057-NEW.cmake:8 \(add_custom_command\):
+ "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake
new file mode 100644
index 0000000000..22dbfb343d
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-NEW.cmake
@@ -0,0 +1,13 @@
+cmake_policy(SET CMP0057 NEW)
+
+add_custom_command(OUTPUT out1
+ COMMAND ${CMAKE_COMMAND} -E echo out1
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_command(OUTPUT out2
+ COMMAND ${CMAKE_COMMAND} -E echo out2
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_target(mytarget1 ALL DEPENDS out1 out2)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake
new file mode 100644
index 0000000000..ccf4fcb3c5
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-OLD.cmake
@@ -0,0 +1,13 @@
+cmake_policy(SET CMP0057 OLD)
+
+add_custom_command(OUTPUT out1
+ COMMAND ${CMAKE_COMMAND} -E echo out1
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_command(OUTPUT out2
+ COMMAND ${CMAKE_COMMAND} -E echo out2
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_target(mytarget1 ALL DEPENDS out1 out2)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt
new file mode 100644
index 0000000000..da3a1cbf1b
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-WARN-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at CMP0057-WARN.cmake:6 \(add_custom_command\):
+ Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications
+ for the same file. Run "cmake --help-policy CMP0057" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ "input.txt" can only be specified as a custom command MAIN_DEPENDENCY once.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake
new file mode 100644
index 0000000000..1837968b7c
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-WARN.cmake
@@ -0,0 +1,11 @@
+add_custom_command(OUTPUT out1
+ COMMAND ${CMAKE_COMMAND} -E echo out1
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_command(OUTPUT out2
+ COMMAND ${CMAKE_COMMAND} -E echo out2
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_target(mytarget1 ALL DEPENDS out1 out2)
diff --git a/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake
new file mode 100644
index 0000000000..8ce02f96ca
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMP0057-once_is_ok.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0057 NEW)
+
+add_custom_command(OUTPUT out1
+ COMMAND ${CMAKE_COMMAND} -E echo out1
+ MAIN_DEPENDENCY input.txt
+)
+
+add_custom_target(mytarget1 ALL DEPENDS out1)
diff --git a/Tests/RunCMake/CMP0057/CMakeLists.txt b/Tests/RunCMake/CMP0057/CMakeLists.txt
new file mode 100644
index 0000000000..ef2163c298
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.1)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0057/RunCMakeTest.cmake b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake
new file mode 100644
index 0000000000..f79235f98c
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/RunCMakeTest.cmake
@@ -0,0 +1,7 @@
+include(RunCMake)
+
+run_cmake(CMP0057-OLD)
+run_cmake(CMP0057-NEW)
+run_cmake(CMP0057-WARN)
+
+run_cmake(CMP0057-once_is_ok)
diff --git a/Tests/RunCMake/CMP0057/input.txt b/Tests/RunCMake/CMP0057/input.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMP0057/input.txt
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 9f1256ea78..1bcc3f34ef 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -63,6 +63,7 @@ add_RunCMake_test(CMP0051)
add_RunCMake_test(CMP0053)
add_RunCMake_test(CMP0054)
add_RunCMake_test(CMP0055)
+add_RunCMake_test(CMP0057)
add_RunCMake_test(CTest)
if(NOT CMake_TEST_EXTERNAL_CMAKE)