summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.h9
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx34
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx140
-rw-r--r--Source/CTest/cmCTestTestHandler.h15
-rw-r--r--Source/CTest/cmParsePythonCoverage.cxx113
-rw-r--r--Source/CTest/cmParsePythonCoverage.h48
-rw-r--r--Source/CursesDialog/CMakeLists.txt1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx25
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx106
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h39
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx9
-rw-r--r--Source/cmAddCustomCommandCommand.h4
-rw-r--r--Source/cmAddDependenciesCommand.h12
-rw-r--r--Source/cmAddLibraryCommand.cxx40
-rw-r--r--Source/cmAddLibraryCommand.h10
-rw-r--r--Source/cmAddTestCommand.h3
-rw-r--r--Source/cmCTest.cxx6
-rw-r--r--Source/cmCommandArgumentLexer.cxx4
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmComputeLinkInformation.cxx5
-rw-r--r--Source/cmCoreTryCompile.cxx33
-rw-r--r--Source/cmCreateTestSourceList.h2
-rw-r--r--Source/cmDependsFortranLexer.cxx4
-rw-r--r--Source/cmDependsJavaLexer.cxx4
-rw-r--r--Source/cmDocumentGeneratorExpressions.h3
-rw-r--r--Source/cmDocumentVariables.cxx48
-rw-r--r--Source/cmDocumentation.cxx8
-rw-r--r--Source/cmDocumentation.h13
-rw-r--r--Source/cmExportBuildFileGenerator.cxx24
-rw-r--r--Source/cmExportCommand.cxx3
-rw-r--r--Source/cmExportFileGenerator.cxx19
-rw-r--r--Source/cmExportInstallFileGenerator.cxx19
-rw-r--r--Source/cmExportLibraryDependencies.cxx12
-rw-r--r--Source/cmExprLexer.cxx4
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorExpression.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx35
-rw-r--r--Source/cmGlobalGenerator.cxx16
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx7
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx18
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx27
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx25
-rw-r--r--Source/cmGraphVizWriter.cxx4
-rw-r--r--Source/cmIncludeCommand.h4
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Source/cmInstallExportGenerator.cxx24
-rw-r--r--Source/cmInstallGenerator.cxx14
-rw-r--r--Source/cmInstallScriptGenerator.cxx6
-rw-r--r--Source/cmInstallTargetGenerator.cxx29
-rw-r--r--Source/cmListFileLexer.c1
-rw-r--r--Source/cmListFileLexer.in.l1
-rw-r--r--Source/cmLocalGenerator.cxx83
-rw-r--r--Source/cmLocalNinjaGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx32
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx14
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx31
-rw-r--r--Source/cmMarkAsAdvancedCommand.h2
-rw-r--r--Source/cmNewLineStyle.cxx2
-rw-r--r--Source/cmPolicies.cxx64
-rw-r--r--Source/cmQtAutomoc.cxx50
-rw-r--r--Source/cmScriptGenerator.cxx10
-rw-r--r--Source/cmSetTestsPropertiesCommand.h3
-rw-r--r--Source/cmTarget.cxx217
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx14
-rw-r--r--Source/cmTargetPropCommandBase.cxx9
-rw-r--r--Source/cmTestGenerator.cxx62
-rw-r--r--Source/cmTryRunCommand.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx8
-rw-r--r--Source/cmake.cxx1372
-rw-r--r--Source/cmake.h30
-rw-r--r--Source/cmakemain.cxx3
-rw-r--r--Source/cmcmd.cxx1374
-rw-r--r--Source/cmcmd.h54
-rw-r--r--Source/ctest.cxx7
85 files changed, 2778 insertions, 1772 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8412e3e..9b81e8b 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -439,6 +439,7 @@ set(CTEST_SRCS cmCTest.cxx
CTest/cmParseCacheCoverage.cxx
CTest/cmParseGTMCoverage.cxx
CTest/cmParsePHPCoverage.cxx
+ CTest/cmParsePythonCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
CTest/cmCTestGenericHandler.cxx
CTest/cmCTestHandlerCommand.cxx
@@ -545,7 +546,7 @@ if(APPLE)
endif()
# Build CMake executable
-add_executable(cmake cmakemain.cxx)
+add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h)
target_link_libraries(cmake CMakeLib)
# Build special executable for running programs on Windows 98.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e7d0bb7..6298218 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20131007)
+set(CMake_VERSION_TWEAK 20131009)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 8fafef9..5cb2280 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -160,9 +160,10 @@ protected:
* CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
* with CPACK_COMPONENT_xxxx_<NAME>_DISPLAY_NAME if
* CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME is ON.
- * @param[in] initialPackageFileName
- * @param[in] groupOrComponentName
- * @param[in] isGroupName
+ * @param[in] initialPackageFileName the initial package name to be mangled
+ * @param[in] groupOrComponentName the name of the group/component
+ * @param[in] isGroupName true if previous name refers to a group,
+ * false otherwise
*/
virtual std::string GetComponentPackageFileName(
const std::string& initialPackageFileName,
@@ -172,7 +173,7 @@ protected:
/**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
- * @pre @ref toplevel has been filled-in
+ * @pre the @ref toplevel has been filled-in
* @pre the list of file @ref files has been populated
* @pre packageFileNames contains at least 1 entry
* @post packageFileNames may have been updated and contains
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 20aded2..ef071b9 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
+#include "cmParsePythonCoverage.h"
#include "cmParseGTMCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmCTest.h"
@@ -392,6 +393,13 @@ int cmCTestCoverageHandler::ProcessHandler()
{
return error;
}
+ file_count += this->HandlePythonCoverage(&cont);
+ error = cont.Error;
+ if ( file_count < 0 )
+ {
+ return error;
+ }
+
file_count += this->HandleMumpsCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
@@ -761,6 +769,32 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
+
+//----------------------------------------------------------------------
+int cmCTestCoverageHandler::HandlePythonCoverage(
+ cmCTestCoverageHandlerContainer* cont)
+{
+ cmParsePythonCoverage cov(*cont, this->CTest);
+
+ // Assume the coverage.xml is in the source directory
+ std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml";
+
+ if(cmSystemTools::FileExists(coverageXMLFile.c_str()))
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Parsing coverage.py XML file: " << coverageXMLFile
+ << std::endl);
+ cov.ReadCoverageXML(coverageXMLFile.c_str());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Cannot find coverage.py XML file: " << coverageXMLFile
+ << std::endl);
+ }
+ return static_cast<int>(cont->TotalCoverage.size());
+}
+
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleMumpsCoverage(
cmCTestCoverageHandlerContainer* cont)
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 92b0b22..3506928 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -70,6 +70,10 @@ private:
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);
+
+ //! Handle coverage for Python with coverage.py
+ int HandlePythonCoverage(cmCTestCoverageHandlerContainer* cont);
+
//! Handle coverage for mumps
int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 497774d..09d343d 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -20,6 +20,7 @@
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
+#include <cmsys/Directory.hxx>
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -249,7 +250,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ADD_TEST";}
+ virtual const char* GetName() const { return "add_test";}
// Unused methods
virtual const char* GetTerseDocumentation() const { return ""; }
@@ -297,7 +298,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";}
+ virtual const char* GetName() const { return "set_tests_properties";}
// Unused methods
virtual const char* GetTerseDocumentation() const { return ""; }
@@ -537,6 +538,7 @@ int cmCTestTestHandler::ProcessHandler()
this->UseExcludeRegExp();
this->SetExcludeRegExp(val);
}
+ this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
this->TestResults.clear();
@@ -819,6 +821,13 @@ void cmCTestTestHandler::ComputeTestList()
{
this->TestList.clear(); // clear list of test
this->GetListOfTests();
+
+ if (this->RerunFailed)
+ {
+ this->ComputeTestListForRerunFailed();
+ return;
+ }
+
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size();
// how many tests are in based on RegExp?
int inREcnt = 0;
@@ -881,9 +890,47 @@ void cmCTestTestHandler::ComputeTestList()
this->TotalNumberOfTests = this->TestList.size();
// Set the TestList to the final list of all test
this->TestList = finalList;
+
+ this->UpdateMaxTestNameWidth();
+}
+
+void cmCTestTestHandler::ComputeTestListForRerunFailed()
+{
+ this->ExpandTestsToRunInformationForRerunFailed();
+
+ cmCTestTestHandler::ListOfTests::iterator it;
+ ListOfTests finalList;
+ int cnt = 0;
+ for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ )
+ {
+ cnt ++;
+
+ // if this test is not in our list of tests to run, then skip it.
+ if ((this->TestsToRun.size() &&
+ std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
+ == this->TestsToRun.end()))
+ {
+ continue;
+ }
+
+ it->Index = cnt;
+ finalList.push_back(*it);
+ }
+
+ // Save the total number of tests before exclusions
+ this->TotalNumberOfTests = this->TestList.size();
+
+ // Set the TestList to the list of failed tests to rerun
+ this->TestList = finalList;
+
+ this->UpdateMaxTestNameWidth();
+}
+
+void cmCTestTestHandler::UpdateMaxTestNameWidth()
+{
std::string::size_type max = this->CTest->GetMaxTestNameWidth();
- for (it = this->TestList.begin();
- it != this->TestList.end(); it ++ )
+ for ( cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
+ it != this->TestList.end(); it ++ )
{
cmCTestTestProperties& p = *it;
if(max < p.Name.size())
@@ -1708,6 +1755,91 @@ void cmCTestTestHandler::ExpandTestsToRunInformation(size_t numTests)
this->TestsToRun.erase(new_end, this->TestsToRun.end());
}
+void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
+{
+
+ std::string dirName = this->CTest->GetBinaryDir() + "/Testing/Temporary";
+
+ cmsys::Directory directory;
+ if (directory.Load(dirName.c_str()) == 0)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to read the contents of "
+ << dirName << std::endl);
+ return;
+ }
+
+ int numFiles = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
+ std::string pattern = "LastTestsFailed";
+ std::string logName = "";
+
+ for (int i = 0; i < numFiles; ++i)
+ {
+ std::string fileName = directory.GetFile(i);
+ // bcc crashes if we attempt a normal substring comparison,
+ // hence the following workaround
+ std::string fileNameSubstring = fileName.substr(0, pattern.length());
+ if (fileNameSubstring.compare(pattern) != 0)
+ {
+ continue;
+ }
+ if (logName == "")
+ {
+ logName = fileName;
+ }
+ else
+ {
+ // if multiple matching logs were found we use the most recently
+ // modified one.
+ int res;
+ cmSystemTools::FileTimeCompare(logName.c_str(), fileName.c_str(), &res);
+ if (res == -1)
+ {
+ logName = fileName;
+ }
+ }
+ }
+
+ std::string lastTestsFailedLog = this->CTest->GetBinaryDir()
+ + "/Testing/Temporary/" + logName;
+
+ if ( !cmSystemTools::FileExists(lastTestsFailedLog.c_str()) )
+ {
+ if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, lastTestsFailedLog
+ << " does not exist!" << std::endl);
+ }
+ return;
+ }
+
+ // parse the list of tests to rerun from LastTestsFailed.log
+ std::ifstream ifs(lastTestsFailedLog.c_str());
+ if ( ifs )
+ {
+ std::string line;
+ std::string::size_type pos;
+ while ( cmSystemTools::GetLineFromStream(ifs, line) )
+ {
+ pos = line.find(':', 0);
+ if (pos == line.npos)
+ {
+ continue;
+ }
+
+ int val = atoi(line.substr(0, pos).c_str());
+ this->TestsToRun.push_back(val);
+ }
+ ifs.close();
+ }
+ else if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem reading file: "
+ << lastTestsFailedLog.c_str() <<
+ " while generating list of previously failed tests." << std::endl);
+ }
+}
+
//----------------------------------------------------------------------
// Just for convenience
#define SPACE_REGEX "[ \t\r\n]"
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 93b793b..398f052 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -44,6 +44,12 @@ public:
void SetUseUnion(bool val) { this->UseUnion = val; }
/**
+ * Set whether or not CTest should only execute the tests that failed
+ * on the previous run. By default this is false.
+ */
+ void SetRerunFailed(bool val) { this->RerunFailed = val; }
+
+ /**
* This method is called when reading CTest custom file
*/
void PopulateCustomVectors(cmMakefile *mf);
@@ -213,6 +219,12 @@ private:
// based on union regex and -I stuff
void ComputeTestList();
+ // compute the lists of tests that will actually run
+ // based on LastTestFailed.log
+ void ComputeTestListForRerunFailed();
+
+ void UpdateMaxTestNameWidth();
+
bool GetValue(const char* tag,
std::string& value,
std::ifstream& fin);
@@ -235,6 +247,7 @@ private:
const char* GetTestStatus(int status);
void ExpandTestsToRunInformation(size_t numPossibleTests);
+ void ExpandTestsToRunInformationForRerunFailed();
std::vector<cmStdString> CustomPreTest;
std::vector<cmStdString> CustomPostTest;
@@ -268,6 +281,8 @@ private:
cmsys::RegularExpression DartStuff;
std::ostream* LogFile;
+
+ bool RerunFailed;
};
#endif
diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx
new file mode 100644
index 0000000..a086f13
--- /dev/null
+++ b/Source/CTest/cmParsePythonCoverage.cxx
@@ -0,0 +1,113 @@
+#include "cmStandardIncludes.h"
+#include "cmSystemTools.h"
+#include "cmXMLParser.h"
+#include "cmParsePythonCoverage.h"
+#include <cmsys/Directory.hxx>
+
+
+//----------------------------------------------------------------------------
+class cmParsePythonCoverage::XMLParser: public cmXMLParser
+{
+public:
+ XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont)
+ : CTest(ctest), Coverage(cont)
+ {
+ }
+
+ virtual ~XMLParser()
+ {
+ }
+
+protected:
+
+ virtual void StartElement(const char* name, const char** atts)
+ {
+ if(strcmp(name, "class") == 0)
+ {
+ int tagCount = 0;
+ while(true)
+ {
+ if(strcmp(atts[tagCount], "filename") == 0)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: "
+ << atts[tagCount+1] << std::endl);
+ this->CurFileName = this->Coverage.SourceDir + "/" +
+ atts[tagCount+1];
+ FileLinesType& curFileLines =
+ this->Coverage.TotalCoverage[this->CurFileName];
+ std::ifstream fin(this->CurFileName.c_str());
+ if(!fin)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Python Coverage: Error opening " << this->CurFileName
+ << std::endl);
+ this->Coverage.Error++;
+ break;
+ }
+
+ std::string line;
+ curFileLines.push_back(-1);
+ while(cmSystemTools::GetLineFromStream(fin, line))
+ {
+ curFileLines.push_back(-1);
+ }
+
+ break;
+ }
+ ++tagCount;
+ }
+ }
+ else if(strcmp(name, "line") == 0)
+ {
+ int tagCount = 0;
+ int curNumber = -1;
+ int curHits = -1;
+ while(true)
+ {
+ if(strcmp(atts[tagCount], "hits") == 0)
+ {
+ curHits = atoi(atts[tagCount+1]);
+ }
+ else if(strcmp(atts[tagCount], "number") == 0)
+ {
+ curNumber = atoi(atts[tagCount+1]);
+ }
+
+ if(curHits > -1 && curNumber > -1)
+ {
+ FileLinesType& curFileLines =
+ this->Coverage.TotalCoverage[this->CurFileName];
+ curFileLines[curNumber] = curHits;
+ break;
+ }
+ ++tagCount;
+ }
+ }
+ }
+
+ virtual void EndElement(const char*) {}
+
+private:
+
+ typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector
+ FileLinesType;
+ cmCTest* CTest;
+ cmCTestCoverageHandlerContainer& Coverage;
+ std::string CurFileName;
+
+};
+
+
+cmParsePythonCoverage::cmParsePythonCoverage(
+ cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest)
+ :Coverage(cont), CTest(ctest)
+{
+}
+
+bool cmParsePythonCoverage::ReadCoverageXML(const char* xmlFile)
+{
+ cmParsePythonCoverage::XMLParser parser(this->CTest, this->Coverage);
+ parser.ParseFile(xmlFile);
+ return true;
+}
diff --git a/Source/CTest/cmParsePythonCoverage.h b/Source/CTest/cmParsePythonCoverage.h
new file mode 100644
index 0000000..668c7f9
--- /dev/null
+++ b/Source/CTest/cmParsePythonCoverage.h
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmParsePythonCoverage_h
+#define cmParsePythonCoverage_h
+
+#include "cmStandardIncludes.h"
+#include "cmCTestCoverageHandler.h"
+
+/** \class cmParsePythonCoverage
+ * \brief Parse coverage.py Python coverage information
+ *
+ * This class is used to parse the output of the coverage.py tool that
+ * is currently maintained by Ned Batchelder. That tool has a command
+ * that produces xml output in the format typically output by the common
+ * Java-based Cobertura coverage application. This helper class parses
+ * that XML file to fill the coverage-handler container.
+ */
+class cmParsePythonCoverage
+{
+public:
+
+ //! Create the coverage parser by passing in the coverage handler
+ //! container and the cmCTest object
+ cmParsePythonCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest);
+
+ //! Read the XML produced by running `coverage xml`
+ bool ReadCoverageXML(const char* xmlFile);
+
+private:
+
+ class XMLParser;
+ cmCTestCoverageHandlerContainer& Coverage;
+ cmCTest* CTest;
+ std::string CurFileName;
+};
+
+#endif
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index 5efc2fb..548f5a5 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -11,6 +11,7 @@
#=============================================================================
set( CURSES_SRCS
+ CursesDialog/cmCursesOptionsWidget
CursesDialog/cmCursesBoolWidget
CursesDialog/cmCursesCacheEntryComposite
CursesDialog/cmCursesDummyWidget
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index c58d037..249137f 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmCursesCacheEntryComposite.h"
+#include "cmCursesOptionsWidget.h"
#include "cmCursesStringWidget.h"
#include "cmCursesLabelWidget.h"
#include "cmCursesBoolWidget.h"
@@ -69,9 +70,27 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
it.GetValue());
break;
case cmCacheManager::STRING:
- this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
- it.GetValue());
+ if(it.PropertyExists("STRINGS"))
+ {
+ cmCursesOptionsWidget* ow =
+ new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
+ this->Entry = ow;
+ std::vector<std::string> options;
+ cmSystemTools::ExpandListArgument(
+ std::string(it.GetProperty("STRINGS")), options);
+ for(std::vector<std::string>::iterator
+ si = options.begin(); si != options.end(); ++si)
+ {
+ ow->AddOption(*si);
+ }
+ ow->SetOption(it.GetValue());
+ }
+ else
+ {
+ this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
+ static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
+ it.GetValue());
+ }
break;
case cmCacheManager::UNINITIALIZED:
cmSystemTools::Error("Found an undefined variable: ", it.GetName());
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
new file mode 100644
index 0000000..652b2df
--- /dev/null
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -0,0 +1,106 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCursesOptionsWidget.h"
+#include "cmCursesMainForm.h"
+
+inline int ctrl(int z)
+{
+ return (z&037);
+}
+
+cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height,
+ int left, int top) :
+ cmCursesWidget(width, height, left, top)
+{
+ this->Type = cmCacheManager::BOOL; // this is a bit of a hack
+ // there is no option type, and string type causes ccmake to cast
+ // the widget into a string widget at some point. BOOL is safe for
+ // now.
+ set_field_fore(this->Field, A_NORMAL);
+ set_field_back(this->Field, A_STANDOUT);
+ field_opts_off(this->Field, O_STATIC);
+}
+
+bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w)
+{
+
+ // 10 == enter
+ if (key == 10 || key == KEY_ENTER)
+ {
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ }
+ else if (key == KEY_LEFT || key == ctrl('b'))
+ {
+ touchwin(w);
+ wrefresh(w);
+ this->PreviousOption();
+ return true;
+ }
+ else if (key == KEY_RIGHT || key == ctrl('f'))
+ {
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ return false;
+}
+
+void cmCursesOptionsWidget::AddOption(std::string const & option )
+{
+ this->Options.push_back(option);
+}
+
+void cmCursesOptionsWidget::NextOption()
+{
+ this->CurrentOption++;
+ if(this->CurrentOption > this->Options.size()-1)
+ {
+ this->CurrentOption = 0;
+ }
+ this->SetValue(this->Options[this->CurrentOption].c_str());
+}
+void cmCursesOptionsWidget::PreviousOption()
+{
+ if(this->CurrentOption == 0)
+ {
+ this->CurrentOption = this->Options.size()-1;
+ }
+ else
+ {
+ this->CurrentOption--;
+ }
+ this->SetValue(this->Options[this->CurrentOption].c_str());
+}
+
+void cmCursesOptionsWidget::SetOption(const char* value)
+{
+ this->CurrentOption = 0; // default to 0 index
+ this->SetValue(value);
+ int index = 0;
+ for(std::vector<std::string>::iterator i = this->Options.begin();
+ i != this->Options.end(); ++i)
+ {
+ if(*i == value)
+ {
+ this->CurrentOption = index;
+ }
+ index++;
+ }
+}
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
new file mode 100644
index 0000000..b52ac9d
--- /dev/null
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -0,0 +1,39 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef __cmCursesOptionsWidget_h
+#define __cmCursesOptionsWidget_h
+
+#include "cmCursesWidget.h"
+class cmCursesMainForm;
+
+class cmCursesOptionsWidget : public cmCursesWidget
+{
+public:
+ cmCursesOptionsWidget(int width, int height, int left, int top);
+
+ // Description:
+ // Handle user input. Called by the container of this widget
+ // when this widget has focus. Returns true if the input was
+ // handled.
+ virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ void SetOption(const char*);
+ void AddOption(std::string const &);
+ void NextOption();
+ void PreviousOption();
+protected:
+ cmCursesOptionsWidget(const cmCursesOptionsWidget& from);
+ void operator=(const cmCursesOptionsWidget&);
+ std::vector<std::string> Options;
+ std::vector<std::string>::size_type CurrentOption;
+};
+
+#endif // __cmCursesOptionsWidget_h
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 4d62f72..a4dfdc9 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -66,9 +66,8 @@ CMakeSetupDialog::CMakeSetupDialog()
// create the GUI
QSettings settings;
settings.beginGroup("Settings/StartPath");
- int h = settings.value("Height", 500).toInt();
- int w = settings.value("Width", 700).toInt();
- this->resize(w, h);
+ restoreGeometry(settings.value("geometry").toByteArray());
+ restoreState(settings.value("windowState").toByteArray());
this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
@@ -299,8 +298,8 @@ CMakeSetupDialog::~CMakeSetupDialog()
{
QSettings settings;
settings.beginGroup("Settings/StartPath");
- settings.setValue("Height", this->height());
- settings.setValue("Width", this->width());
+ settings.setValue("windowState", QVariant(saveState()));
+ settings.setValue("geometry", QVariant(saveGeometry()));
settings.setValue("SplitterSizes", this->Splitter->saveState());
// wait for thread to stop
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 1cc1e3a..2504185 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -16,9 +16,7 @@
#include "cmDocumentGeneratorExpressions.h"
/** \class cmAddCustomCommandCommand
- * \brief
- *
- * cmAddCustomCommandCommand defines a new command (rule) that can
+ * \brief cmAddCustomCommandCommand defines a new command (rule) that can
* be executed within the build process
*
*/
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index ed80067..148fd99 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -56,14 +56,14 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " add_dependencies(target-name depend-target1\n"
- " depend-target2 ...)\n"
- "Make a top-level target depend on other top-level targets. A "
- "top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, "
- "or ADD_CUSTOM_TARGET. Adding dependencies with this command "
- "can be used to make sure one target is built before another target. "
+ " add_dependencies(<target> [<target-dependency>]...)\n"
+ "Make a top-level <target> depend on other top-level targets to "
+ "ensure that they build before <target> does. "
+ "A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, "
+ "or ADD_CUSTOM_TARGET. "
"Dependencies added to an IMPORTED target are followed transitively "
"in its place since the target itself does not build. "
+ "\n"
"See the DEPENDS option of ADD_CUSTOM_TARGET "
"and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom "
"rules. See the OBJECT_DEPENDS option in "
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index cbc6ed1..0e61c99 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -82,6 +82,12 @@ bool cmAddLibraryCommand
++s;
isAlias = true;
}
+ else if(libType == "INTERFACE")
+ {
+ ++s;
+ type = cmTarget::INTERFACE_LIBRARY;
+ haveSpecifiedType = true;
+ }
else if(*s == "EXCLUDE_FROM_ALL")
{
++s;
@@ -151,7 +157,8 @@ bool cmAddLibraryCommand
if(aliasedType != cmTarget::SHARED_LIBRARY
&& aliasedType != cmTarget::STATIC_LIBRARY
&& aliasedType != cmTarget::MODULE_LIBRARY
- && aliasedType != cmTarget::OBJECT_LIBRARY)
+ && aliasedType != cmTarget::OBJECT_LIBRARY
+ && aliasedType != cmTarget::INTERFACE_LIBRARY)
{
cmOStringStream e;
e << "cannot create ALIAS target \"" << libName
@@ -213,6 +220,16 @@ bool cmAddLibraryCommand
);
return true;
}
+ if(type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(libName))
+ {
+ cmOStringStream e;
+ e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(libName.c_str()))
@@ -249,6 +266,26 @@ bool cmAddLibraryCommand
}
}
+ std::vector<std::string> srclists;
+
+ if(type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(libName)
+ || libName.find("::") != std::string::npos)
+ {
+ cmOStringStream e;
+ e << "Invalid name for INTERFACE library target: " << libName;
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ this->Makefile->AddLibrary(libName.c_str(),
+ type,
+ srclists,
+ excludeFromAll);
+ return true;
+ }
+
if (s == args.end())
{
std::string msg = "You have called ADD_LIBRARY for library ";
@@ -258,7 +295,6 @@ bool cmAddLibraryCommand
cmSystemTools::Message(msg.c_str() ,"Warning");
}
- std::vector<std::string> srclists;
while (s != args.end())
{
srclists.push_back(*s);
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 59354b0..64d048b 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -151,6 +151,16 @@ public:
"properties of <target>, that is, it may not be used as the operand of "
"set_property, set_target_properties, target_link_libraries etc. An "
"ALIAS target may not be installed of exported."
+ "\n"
+ "The signature\n"
+ " add_library(<name> INTERFACE)\n"
+ "creates an interface target. An interface target does not directly "
+ "create build output, though it may have properties set on it and it "
+ "may be installed, exported and imported. Typically the INTERFACE_* "
+ "properties are populated on the interface target using the "
+ "set_property(), target_link_libraries(), target_include_directories() "
+ "and target_compile_defintions() commands, and then it is used as an "
+ "argument to target_link_libraries() like any other target."
;
}
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index ec7fda3..ce98aaa 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -66,7 +66,8 @@ public:
"built by this project or an arbitrary executable on the "
"system (like tclsh). The test will be run with the current working "
"directory set to the CMakeList.txt files corresponding directory "
- "in the binary tree.\n"
+ "in the binary tree. Tests added using this signature do not support "
+ "generator expressions.\n"
"\n"
" add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n"
" [WORKING_DIRECTORY dir]\n"
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 14e1f50..feae61a 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2187,6 +2187,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->GetHandler("memcheck")->
SetPersistentOption("ExcludeRegularExpression", args[i].c_str());
}
+
+ if(this->CheckArgument(arg, "--rerun-failed"))
+ {
+ this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
+ this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
+ }
}
//----------------------------------------------------------------------
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx
index e68f6b5..e62e53e 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/cmCommandArgumentLexer.cxx
@@ -1820,7 +1820,7 @@ void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yysca
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmCommandArgument_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -1835,7 +1835,7 @@ void cmCommandArgument_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmCommandArgument_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index dec2b54..a2f3f7d 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -355,9 +355,16 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
{
+ const bool isIface =
+ entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
+ if (isIface)
+ {
+ return;
+ }
+
// Handle dependent shared libraries.
this->FollowSharedDeps(depender_index, iface);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index fb7b5b6..d3b28ed 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -655,6 +655,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
(this->UseImportLibrary &&
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
+ if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->Items.push_back(Item(std::string(), true, tgt));
+ return;
+ }
// Pass the full path to the target file.
std::string lib = tgt->GetFullPath(config, implib, true);
if(!this->LinkDependsNoShared ||
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 086f27a..bc4bf18 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -99,6 +99,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
case cmTarget::SHARED_LIBRARY:
case cmTarget::STATIC_LIBRARY:
+ case cmTarget::INTERFACE_LIBRARY:
case cmTarget::UNKNOWN_LIBRARY:
break;
case cmTarget::EXECUTABLE:
@@ -294,7 +295,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion());
if(def)
{
- fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
+ fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def);
}
std::string projectLangs;
@@ -307,35 +308,35 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if(const char* rulesOverridePath =
this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
{
- fprintf(fout, "SET(%s \"%s\")\n",
+ fprintf(fout, "set(%s \"%s\")\n",
rulesOverrideLang.c_str(), rulesOverridePath);
}
else if(const char* rulesOverridePath2 =
this->Makefile->GetDefinition(rulesOverrideBase.c_str()))
{
- fprintf(fout, "SET(%s \"%s\")\n",
+ fprintf(fout, "set(%s \"%s\")\n",
rulesOverrideBase.c_str(), rulesOverridePath2);
}
}
- fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
- fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n");
+ fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
+ fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n");
for(std::set<std::string>::iterator li = testLangs.begin();
li != testLangs.end(); ++li)
{
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
- fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(),
+ fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(),
lg->EscapeForCMake(flags?flags:"").c_str());
- fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
+ fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
- fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n");
- fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n");
- fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n");
+ fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n");
+ fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
+ fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on
if (compileDefs.size())
{
- fprintf(fout, "ADD_DEFINITIONS( ");
+ fprintf(fout, "add_definitions( ");
for (size_t i = 0; i < compileDefs.size(); ++i)
{
fprintf(fout,"%s ",compileDefs[i].c_str());
@@ -406,14 +407,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
{
- fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
+ fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
}
/* Put the executable at a known location (for COPY_FILE). */
- fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
+ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(%s", targetName);
+ fprintf(fout, "add_executable(%s", targetName);
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
{
@@ -429,11 +430,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (useOldLinkLibs)
{
fprintf(fout,
- "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName);
}
else
{
- fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n",
+ fprintf(fout, "target_link_libraries(%s %s)\n",
targetName,
libsToLink.c_str());
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 3aa0a79..b9c6341 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -15,7 +15,7 @@
#include "cmCommand.h"
/** \class cmCreateTestSourceList
- * \brief
+ * \brief Test driver generation command
*
*/
diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx
index 924d9d2..1eff1e4 100644
--- a/Source/cmDependsFortranLexer.cxx
+++ b/Source/cmDependsFortranLexer.cxx
@@ -2165,7 +2165,7 @@ void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscan
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -2180,7 +2180,7 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param line_number
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx
index 0af44b0..1e505a5 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/cmDependsJavaLexer.cxx
@@ -2330,7 +2330,7 @@ void cmDependsJava_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmDependsJava_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -2345,7 +2345,7 @@ void cmDependsJava_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmDependsJava_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 46cd77e..7bab741 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -40,6 +40,9 @@
"is exported using export(), or when the target is used by another " \
"target in the same buildsystem. Expands to the empty string " \
"otherwise.\n" \
+ " $<PLATFORM_ID> = The CMake-id of the platform " \
+ " $<PLATFORM_ID:comp> = '1' if the The CMake-id of the " \
+ "platform matches comp, otherwise '0'.\n" \
" $<C_COMPILER_ID> = The CMake-id of the C compiler " \
"used.\n" \
" $<C_COMPILER_ID:comp> = '1' if the CMake-id of the C " \
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index a2a1bd6..58634ea 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -428,7 +428,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"PROJECT command.",false,
"Variables that Provide Information");
cm->DefineProperty
- ("[Project name]_BINARY_DIR", cmProperty::VARIABLE,
+ ("<PROJECT-NAME>_BINARY_DIR", cmProperty::VARIABLE,
"Top level binary directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the binary directory for the project. "
@@ -436,7 +436,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"several projects.",false,
"Variables that Provide Information");
cm->DefineProperty
- ("[Project name]_SOURCE_DIR", cmProperty::VARIABLE,
+ ("<PROJECT-NAME>_SOURCE_DIR", cmProperty::VARIABLE,
"Top level source directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the source directory for the project."
@@ -1477,7 +1477,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"On most compilers this is \"-L\".",false,
"Variables that Control the Build");
cm->DefineProperty
- ("CMAKE_LINK_DEF_FILE_FLAG ", cmProperty::VARIABLE,
+ ("CMAKE_LINK_DEF_FILE_FLAG", cmProperty::VARIABLE,
"Linker flag to be used to specify a .def file for dll creation.",
"The flag will be used to add a .def file when creating "
"a dll on Windows; this is only defined on Windows."
@@ -1563,6 +1563,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
false,
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_NO_SYSTEM_FROM_IMPORTED", cmProperty::VARIABLE,
+ "Default value for NO_SYSTEM_FROM_IMPORTED of targets.",
+ "This variable is used to initialize the "
+ "NO_SYSTEM_FROM_IMPORTED property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+ cm->DefineProperty
("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE,
"Default value for <LANG>_VISIBILITY_PRESET of targets.",
"This variable is used to initialize the "
@@ -1578,6 +1586,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"See that target property for additional information.",
false,
"Variables that Control the Build");
+ cm->DefineProperty
+ ("CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::VARIABLE,
+ "Default value for MAP_IMPORTED_CONFIG_<CONFIG> of targets.",
+ "This variable is used to initialize the "
+ "MAP_IMPORTED_CONFIG_<CONFIG> property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
// also be defined whenever CMake has loaded its support for compiling (LANG)
@@ -1660,6 +1676,28 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables for Languages");
cm->DefineProperty
+ ("CMAKE_<LANG>_SIMULATE_ID", cmProperty::VARIABLE,
+ "Identification string of \"simulated\" compiler.",
+ "Some compilers simulate other compilers to serve as drop-in "
+ "replacements. "
+ "When CMake detects such a compiler it sets this variable to what "
+ "would have been the CMAKE_<LANG>_COMPILER_ID for the simulated "
+ "compiler.",
+ false,
+ "Variables for Languages");
+
+ cm->DefineProperty
+ ("CMAKE_<LANG>_SIMULATE_VERSION", cmProperty::VARIABLE,
+ "Version string of \"simulated\" compiler.",
+ "Some compilers simulate other compilers to serve as drop-in "
+ "replacements. "
+ "When CMake detects such a compiler it sets this variable to what "
+ "would have been the CMAKE_<LANG>_COMPILER_VERSION for the simulated "
+ "compiler.",
+ false,
+ "Variables for Languages");
+
+ cm->DefineProperty
("CMAKE_<LANG>_SIZEOF_DATA_PTR", cmProperty::VARIABLE,
"Size of pointer-to-data types for language <LANG>.",
"This holds the size (in bytes) of pointer-to-data types in the target "
@@ -1854,7 +1892,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables for Languages");
cm->DefineProperty
- ("CMAKE_<LANG>_LINK_EXECUTABLE ", cmProperty::VARIABLE,
+ ("CMAKE_<LANG>_LINK_EXECUTABLE", cmProperty::VARIABLE,
"Rule variable to link an executable.",
"Rule variable to link an executable for the given language."
,false,
@@ -1941,8 +1979,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED",
cmProperty::VARIABLE,0,0);
- cm->DefineProperty("CMAKE_<LANG>_LINK_EXECUTABLE",
- cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG",
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 4edacbb..58ce36b 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -829,10 +829,10 @@ int cmDocumentation::GetStructuredDocFromFile(
std::vector<cmDocumentationEntry>& commands,
cmake* cm)
{
- typedef enum sdoce {
+ enum sdoce {
SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE,
SDOC_SECTION,
- SDOC_UNKNOWN} sdoc_t;
+ SDOC_UNKNOWN};
int nbDocItemFound = 0;
int docCtxIdx = 0;
std::vector<int> docContextStack(60);
@@ -1617,7 +1617,7 @@ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os)
return true;
}
- // Argument was not a command. Complain.
+ // Argument was not a policy. Complain.
os << "Argument \"" << this->CurrentArgument.c_str()
<< "\" to --help-policy is not a CMake policy.\n";
return false;
@@ -1639,7 +1639,7 @@ bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os)
return true;
}
- // Argument was not a command. Complain.
+ // Argument was not a variable. Complain.
os << "Argument \"" << this->CurrentArgument.c_str()
<< "\" to --help-variable is not a defined variable. "
<< "Use --help-variable-list to see all defined variables.\n";
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index e180f60..218f44d 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -154,11 +154,11 @@ public:
/**
* Retrieve the list of documented module located in
* path which match the globing expression globExpr.
- * @param[in] path, directory where to start the search
+ * @param[in] path directory where to start the search
* we will recurse into it.
- * @param[in] globExpr, the globing expression used to
+ * @param[in] globExpr the globing expression used to
* match the file in path.
- * @param[out] the list of obtained pairs (may be empty)
+ * @param[out] docModuleList the list of obtained pairs (may be empty)
* @return 0 on success 1 on error or empty list
*/
int getDocumentedModulesListInDir(
@@ -180,10 +180,9 @@ public:
* @param[in] fname the script file name to be parsed for documentation
* @param[in,out] commands the vector of command/macros documentation
* entry found in the script file.
- * @param[in,out] the cmake object instance to which variable documentation
- * will be attached (using @see cmake::DefineProperty)
- * @param[in] the documentation section in which the property will be
- * inserted.
+ * @param[in,out] cm the cmake object instance to which variable
+ * documentation will be attached
+ * (using @see cmake::DefineProperty)
* @return the number of documented items (command and variable)
* found in the file.
*/
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index cdc3316..243e5ce 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -47,6 +47,10 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
}
return false;
}
+ if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007"); // 2.8.13
+ }
}
this->GenerateExpectedTargetsCode(os, expectedTargets);
@@ -118,16 +122,22 @@ cmExportBuildFileGenerator
// Collect import properties for this target.
cmTarget* target = *tei;
ImportPropertyMap properties;
- this->SetImportLocationProperty(config, suffix, target, properties);
+
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ this->SetImportLocationProperty(config, suffix, target, properties);
+ }
if(!properties.empty())
{
// Get the rest of the target details.
- this->SetImportDetailProperties(config, suffix,
- target, properties, missingTargets);
- this->SetImportLinkInterface(config, suffix,
- cmGeneratorExpression::BuildInterface,
- target, properties, missingTargets);
-
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ this->SetImportDetailProperties(config, suffix,
+ target, properties, missingTargets);
+ this->SetImportLinkInterface(config, suffix,
+ cmGeneratorExpression::BuildInterface,
+ target, properties, missingTargets);
+ }
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 4558fb6..837bb39 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -130,7 +130,8 @@ bool cmExportCommand
if((target->GetType() == cmTarget::EXECUTABLE) ||
(target->GetType() == cmTarget::STATIC_LIBRARY) ||
(target->GetType() == cmTarget::SHARED_LIBRARY) ||
- (target->GetType() == cmTarget::MODULE_LIBRARY))
+ (target->GetType() == cmTarget::MODULE_LIBRARY) ||
+ (target->GetType() == cmTarget::INTERFACE_LIBRARY))
{
targets.push_back(target);
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ef336ea..25c5710 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -378,11 +378,14 @@ void getCompatibleInterfaceProperties(cmTarget *target,
if (!info)
{
- cmMakefile* mf = target->GetMakefile();
- cmOStringStream e;
- e << "Exporting the target \"" << target->GetName() << "\" is not "
- "allowed since its linker language cannot be determined";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ cmMakefile* mf = target->GetMakefile();
+ cmOStringStream e;
+ e << "Exporting the target \"" << target->GetName() << "\" is not "
+ "allowed since its linker language cannot be determined";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
return;
}
@@ -736,9 +739,10 @@ cmExportFileGenerator
"IMPORTED_LINK_INTERFACE_LANGUAGES",
iface->Languages, properties, missingTargets);
+ std::vector<std::string> dummy;
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_DEPENDENT_LIBRARIES",
- iface->SharedDeps, properties, missingTargets);
+ iface->SharedDeps, properties, dummy);
if(iface->Multiplicity > 0)
{
std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
@@ -887,6 +891,9 @@ cmExportFileGenerator
case cmTarget::UNKNOWN_LIBRARY:
os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
+ break;
default: // should never happen
break;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index c8b4a79..c71008e 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -114,6 +114,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
bool require2_8_12 = false;
+ bool require2_8_13 = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
@@ -153,6 +154,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12 = true;
}
}
+ if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ require2_8_13 = true;
+ }
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties);
@@ -160,7 +165,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
- if (require2_8_12)
+ if (require2_8_13)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007");
+ }
+ else if (require2_8_12)
{
this->GenerateRequiredCMakeVersion(os, "2.8.12");
}
@@ -286,6 +295,14 @@ cmExportInstallFileGenerator
cmTargetExport const* te = *tei;
ImportPropertyMap properties;
std::set<std::string> importedLocations;
+ if (!properties.empty()
+ && te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->GenerateImportPropertyCode(os, config, te->Target, properties);
+ this->GenerateImportedFileChecksCode(os, te->Target, properties,
+ importedLocations);
+ continue;
+ }
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index f07b783..e3b1626 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -169,7 +169,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
const char* vertest =
"\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
- fout << "IF(" << vertest << ")\n";
+ fout << "if(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n";
for(std::map<cmStdString, cmStdString>::const_iterator
i = libDepsNew.begin();
@@ -177,10 +177,10 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(!i->second.empty())
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
- fout << "ELSE(" << vertest << ")\n";
+ fout << "else()\n";
fout << " # Information for CMake 2.4 and lower.\n";
for(std::map<cmStdString, cmStdString>::const_iterator
i = libDepsOld.begin();
@@ -188,7 +188,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(!i->second.empty())
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin();
@@ -196,9 +196,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(i->second != "general")
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
- fout << "ENDIF(" << vertest << ")\n";
+ fout << "endif()\n";
return;
}
diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx
index 9947c77..aa384cd 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/cmExprLexer.cxx
@@ -1716,7 +1716,7 @@ void cmExpr_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmExpr_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -1731,7 +1731,7 @@ void cmExpr_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmExpr_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index d73c72c..97853f3 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -71,7 +71,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmTarget *currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (!this->NeedsParsing)
+ if (!this->NeedsEvaluation)
{
return this->Input.c_str();
}
@@ -129,9 +129,9 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
l.Tokenize(this->Input.c_str());
- this->NeedsParsing = l.GetSawGeneratorExpression();
+ this->NeedsEvaluation = l.GetSawGeneratorExpression();
- if (this->NeedsParsing)
+ if (this->NeedsEvaluation)
{
cmGeneratorExpressionParser p(tokens);
p.Parse(this->Evaluators);
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index c20f130..bc0f6c2 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -126,7 +126,7 @@ private:
cmListFileBacktrace Backtrace;
std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const std::string Input;
- bool NeedsParsing;
+ bool NeedsEvaluation;
mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget*> AllTargetsSeen;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index abe4e70..7fd0fdc 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -438,6 +438,39 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
//----------------------------------------------------------------------------
+struct PlatformIdNode : public cmGeneratorExpressionNode
+{
+ PlatformIdNode() {}
+
+ virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ const char *platformId = context->Makefile ?
+ context->Makefile->GetSafeDefinition(
+ "CMAKE_SYSTEM_NAME") : "";
+ if (parameters.size() == 0)
+ {
+ return platformId ? platformId : "";
+ }
+
+ if (!platformId)
+ {
+ return parameters.front().empty() ? "1" : "0";
+ }
+
+ if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0)
+ {
+ return "1";
+ }
+ return "0";
+ }
+} platformIdNode;
+
+//----------------------------------------------------------------------------
static const struct VersionGreaterNode : public cmGeneratorExpressionNode
{
VersionGreaterNode() {}
@@ -1356,6 +1389,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &cCompilerVersionNode;
else if (identifier == "CXX_COMPILER_VERSION")
return &cxxCompilerVersionNode;
+ else if (identifier == "PLATFORM_ID")
+ return &platformIdNode;
else if (identifier == "CONFIGURATION")
return &configurationNode;
else if (identifier == "CONFIG")
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2c3834a..eacf85b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -146,9 +146,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetCacheValue(langComp.c_str());
std::string changeVars;
- if(cname && (path != cname) && (optional==false))
+ if(cname && !optional)
{
- std::string cnameString = cname;
+ std::string cnameString;
+ if(!cmSystemTools::FileIsFullPath(cname))
+ {
+ cnameString = cmSystemTools::FindProgram(cname);
+ }
+ else
+ {
+ cnameString = cname;
+ }
std::string pathString = path;
// get rid of potentially multiple slashes:
cmSystemTools::ConvertToUnixSlashes(cnameString);
@@ -2596,6 +2604,10 @@ void cmGlobalGenerator::WriteSummary()
for(std::map<cmStdString,cmTarget *>::const_iterator ti =
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{
+ if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
this->WriteSummary(ti->second);
fout << ti->second->GetSupportDirectory() << "\n";
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 61d0272..e45d024 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -877,7 +877,12 @@ cmGlobalNinjaGenerator
cmTargetDependSet const& targetDeps =
this->GetTargetDirectDepends(*target);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
- i != targetDeps.end(); ++i) {
+ i != targetDeps.end(); ++i)
+ {
+ if ((*i)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
this->AppendTargetOutputs(*i, outputs);
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 88cd6e5..9e23ae9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -281,7 +281,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Save the generator name
cmakefileStream
<< "# The generator used is:\n"
- << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
+ << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
// for each cmMakefile get its list of dependencies
std::vector<std::string> lfiles;
@@ -312,7 +312,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
- << "SET(CMAKE_MAKEFILE_DEPENDS\n"
+ << "set(CMAKE_MAKEFILE_DEPENDS\n"
<< " \""
<< lg->Convert(cache.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
@@ -335,7 +335,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Set the corresponding makefile in the cmake file.
cmakefileStream
<< "# The corresponding makefile is:\n"
- << "SET(CMAKE_MAKEFILE_OUTPUTS\n"
+ << "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
<< lg->Convert(makefileName.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
@@ -348,7 +348,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
{
cmakefileStream
<< "# Byproducts of CMake generate step:\n"
- << "SET(CMAKE_MAKEFILE_PRODUCTS\n";
+ << "set(CMAKE_MAKEFILE_PRODUCTS\n";
const std::vector<std::string>& outfiles =
lg->GetMakefile()->GetOutputFiles();
for(std::vector<std::string>::const_iterator k = outfiles.begin();
@@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3
cmakefileStream
<< "# Dependency information for all targets:\n";
cmakefileStream
- << "SET(CMAKE_DEPEND_INFO_FILES\n";
+ << "set(CMAKE_DEPEND_INFO_FILES\n";
for (unsigned int i = 0; i < lGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
@@ -881,6 +881,10 @@ cmGlobalUnixMakefileGenerator3
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
+ if ((*di)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
count += this->CountProgressMarksInTarget(*di, emitted);
}
}
@@ -967,6 +971,10 @@ cmGlobalUnixMakefileGenerator3
{
// Create the target-level dependency.
cmTarget const* dep = *i;
+ if (dep->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
cmLocalUnixMakefileGenerator3* lg3 =
static_cast<cmLocalUnixMakefileGenerator3*>
(dep->GetMakefile()->GetLocalGenerator());
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index b3fabda..5296248 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -200,6 +200,10 @@ void cmGlobalVisualStudio6Generator
tt != orderedProjectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// Write the project into the DSW file
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b475665..65eb3a9 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -392,6 +392,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
cmMakefile* mf = target->GetMakefile();
const char *vcprojName =
target->GetProperty("GENERATOR_FILE_NAME");
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index e4244e0..92e40a8 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -202,7 +202,7 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudio8Generator::AddCheckTarget()
+bool cmGlobalVisualStudio8Generator::AddCheckTarget()
{
// Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake.
@@ -216,7 +216,7 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
// Skip the target if no regeneration is to be done.
if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{
- return;
+ return false;
}
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
@@ -315,21 +315,24 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
}
}
+
+ return true;
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate()
{
- this->AddCheckTarget();
-
- // All targets depend on the build-system check target.
- for(std::map<cmStdString,cmTarget *>::const_iterator
- ti = this->TotalTargets.begin();
- ti != this->TotalTargets.end(); ++ti)
+ if(this->AddCheckTarget())
{
- if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+ // All targets depend on the build-system check target.
+ for(std::map<cmStdString,cmTarget *>::const_iterator
+ ti = this->TotalTargets.begin();
+ ti != this->TotalTargets.end(); ++ti)
{
- ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+ {
+ ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ }
}
}
@@ -406,6 +409,10 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
+ if((*i)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
std::string guid = this->GetGUID((*i)->GetName());
fout << "\t\t{" << guid << "} = {" << guid << "}\n";
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index d181742..2376f8a 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -71,7 +71,7 @@ protected:
virtual bool VSLinksDependencies() const { return false; }
- void AddCheckTarget();
+ bool AddCheckTarget();
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 5931016..af80070 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -349,6 +349,10 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target)
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
cmTarget* target, std::set<cmTarget*>& linked)
{
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
if(linked.insert(target).second &&
target->GetType() == cmTarget::STATIC_LIBRARY)
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0a2b32b..5a0fb07 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -976,6 +976,11 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
continue;
}
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
+
if(cmtarget.GetType() == cmTarget::UTILITY ||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
@@ -1686,6 +1691,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
cmXCodeObject* buildSettings,
const char* configName)
{
+ if(target.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
+
std::string flags;
std::string defFlags;
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
@@ -2550,6 +2560,10 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
cmXCodeObject* buildPhases)
{
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return 0;
+ }
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXNativeTarget);
target->AddAttribute("buildPhases", buildPhases);
@@ -2756,6 +2770,10 @@ void cmGlobalXCodeGenerator
::AddDependAndLinkInformation(cmXCodeObject* target)
{
cmTarget* cmtarget = target->GetTarget();
+ if(cmtarget->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
if(!cmtarget)
{
cmSystemTools::Error("Error no target on xobject\n");
@@ -2867,7 +2885,8 @@ void cmGlobalXCodeGenerator
{
linkLibs += this->XCodeEscapePath(li->Value.c_str());
}
- else
+ else if (!li->Target
+ || li->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
linkLibs += li->Value;
}
@@ -2909,6 +2928,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
{
continue;
}
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// add the soon to be generated Info.plist file as a source for a
// MACOSX_BUNDLE file
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 4816da9..3a7070e 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -534,8 +534,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
this->TargetPtrs[libName] = NULL;
- //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
- //<< "\" shape=\"ellipse\"];" << std::endl;
+ // str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
+ // << "\" shape=\"ellipse\"];" << std::endl;
}
}
}
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index d97b7c3..8ff8b20 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -15,9 +15,7 @@
#include "cmCommand.h"
/** \class cmIncludeCommand
- * \brief
- *
- * cmIncludeCommand defines a list of distant
+ * \brief cmIncludeCommand defines a list of distant
* files that can be "included" in the current list file.
* In almost every sense, this is identical to a C/C++
* #include command. Arguments are first expended as usual.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 3c76bd6..d309a2a 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -379,7 +379,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
target->GetType() != cmTarget::STATIC_LIBRARY &&
target->GetType() != cmTarget::SHARED_LIBRARY &&
target->GetType() != cmTarget::MODULE_LIBRARY &&
- target->GetType() != cmTarget::OBJECT_LIBRARY)
+ target->GetType() != cmTarget::OBJECT_LIBRARY &&
+ target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
cmOStringStream e;
e << "TARGETS given target \"" << (*targetIt)
@@ -626,6 +627,11 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
}
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ // Nothing to do. An INTERFACE_LIBRARY can be installed, but the
+ // only effect of that is to make it exportable. It installs no
+ // other files itself.
+ break;
default:
// This should never happen due to the above type check.
// Ignore the case.
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 3e9e6ac..1287ea6 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -183,11 +183,11 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
{
files.push_back(i->second);
std::string config_test = this->CreateConfigTest(i->first.c_str());
- os << indent << "IF(" << config_test << ")\n";
+ os << indent << "if(" << config_test << ")\n";
this->AddInstallRule(os, cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0,
indent.Next());
- os << indent << "ENDIF(" << config_test << ")\n";
+ os << indent << "endif()\n";
files.clear();
}
}
@@ -202,23 +202,23 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
installedDir += "/";
std::string installedFile = installedDir;
installedFile += this->FileName;
- os << indent << "IF(EXISTS \"" << installedFile << "\")\n";
+ os << indent << "if(EXISTS \"" << installedFile << "\")\n";
Indent indentN = indent.Next();
Indent indentNN = indentN.Next();
Indent indentNNN = indentNN.Next();
- os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
+ os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
<< indentN << " \"" << installedFile << "\"\n"
<< indentN << " \"" << this->MainImportFile << "\")\n";
- os << indentN << "IF(EXPORT_FILE_CHANGED)\n";
- os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir
+ os << indentN << "if(EXPORT_FILE_CHANGED)\n";
+ os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir
<< this->EFGen->GetConfigImportFileGlob() << "\")\n";
- os << indentNN << "IF(OLD_CONFIG_FILES)\n";
- os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile
+ os << indentNN << "if(OLD_CONFIG_FILES)\n";
+ os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile
<< "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n";
- os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n";
- os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n";
- os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n";
- os << indent << "ENDIF()\n";
+ os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n";
+ os << indentNN << "endif()\n";
+ os << indentN << "endif()\n";
+ os << indent << "endif()\n";
// Install the main export file.
std::vector<std::string> files;
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 3be2c2b..d105a0c 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -80,18 +80,18 @@ void cmInstallGenerator
}
}
os << "\")\n";
- os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
<< "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "endif()\n";
- os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
<< "DESTINATION forbidden (by caller): "
<< "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "endif()\n";
}
- os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
+ os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional)
{
os << " OPTIONAL";
@@ -153,13 +153,13 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
// Begin this block of installation.
std::string component_test =
this->CreateComponentTest(this->Component.c_str());
- os << indent << "IF(" << component_test << ")\n";
+ os << indent << "if(" << component_test << ")\n";
// Generate the script possibly with per-configuration code.
this->GenerateScriptConfigs(os, indent.Next());
// End this block of installation.
- os << indent << "ENDIF(" << component_test << ")\n\n";
+ os << indent << "endif()\n\n";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index bcfbe63..1ecf021 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -32,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
Indent indent;
std::string component_test =
this->CreateComponentTest(this->Component.c_str());
- os << indent << "IF(" << component_test << ")\n";
+ os << indent << "if(" << component_test << ")\n";
if(this->Code)
{
@@ -40,8 +40,8 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
}
else
{
- os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n";
+ os << indent.Next() << "include(\"" << this->Script << "\")\n";
}
- os << indent << "ENDIF(" << component_test << ")\n\n";
+ os << indent << "endif()\n\n";
}
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index c9624c8..7b9109e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -90,6 +90,11 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break;
case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break;
case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break;
+ case cmTarget::INTERFACE_LIBRARY:
+ // Not reachable. We never create a cmInstallTargetGenerator for
+ // an INTERFACE_LIBRARY.
+ assert(!"INTERFACE_LIBRARY targets have no installable outputs.");
+ break;
case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
@@ -407,10 +412,10 @@ cmInstallTargetGenerator
std::string tws = tw.str();
if(!tws.empty())
{
- os << indent << "IF(EXISTS \"" << file << "\" AND\n"
+ os << indent << "if(EXISTS \"" << file << "\" AND\n"
<< indent << " NOT IS_SYMLINK \"" << file << "\")\n";
os << tws;
- os << indent << "ENDIF()\n";
+ os << indent << "endif()\n";
}
}
@@ -434,7 +439,7 @@ cmInstallTargetGenerator
if(!tws.empty())
{
Indent indent2 = indent.Next().Next();
- os << indent << "FOREACH(file\n";
+ os << indent << "foreach(file\n";
for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
{
@@ -442,7 +447,7 @@ cmInstallTargetGenerator
}
os << indent2 << ")\n";
os << tws;
- os << indent << "ENDFOREACH()\n";
+ os << indent << "endforeach()\n";
}
}
}
@@ -577,7 +582,7 @@ cmInstallTargetGenerator
// install_name value and references.
if(!new_id.empty() || !install_name_remap.empty())
{
- os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool;
+ os << indent << "execute_process(COMMAND \"" << installNameTool;
os << "\"";
if(!new_id.empty())
{
@@ -626,7 +631,7 @@ cmInstallTargetGenerator
// Write a rule to remove the installed file if its rpath is not the
// new rpath. This is needed for existing build/install trees when
// the installed rpath changes but the file is not rebuilt.
- os << indent << "FILE(RPATH_CHECK\n"
+ os << indent << "file(RPATH_CHECK\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n"
<< indent << " RPATH \"" << newRpath << "\")\n";
}
@@ -697,12 +702,12 @@ cmInstallTargetGenerator
// Write a rule to run chrpath to set the install-tree RPATH
if(newRpath.empty())
{
- os << indent << "FILE(RPATH_REMOVE\n"
+ os << indent << "file(RPATH_REMOVE\n"
<< indent << " FILE \"" << toDestDirPath << "\")\n";
}
else
{
- os << indent << "FILE(RPATH_CHANGE\n"
+ os << indent << "file(RPATH_CHANGE\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n"
<< indent << " OLD_RPATH \"" << oldRpath << "\"\n"
<< indent << " NEW_RPATH \"" << newRpath << "\")\n";
@@ -736,11 +741,11 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os,
return;
}
- os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n";
- os << indent << " EXECUTE_PROCESS(COMMAND \""
+ os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
+ os << indent << " execute_process(COMMAND \""
<< this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
<< "\" \"" << toDestDirPath << "\")\n";
- os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
+ os << indent << "endif()\n";
}
//----------------------------------------------------------------------------
@@ -769,6 +774,6 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
return;
}
- os << indent << "EXECUTE_PROCESS(COMMAND \""
+ os << indent << "execute_process(COMMAND \""
<< ranlib << "\" \"" << toDestDirPath << "\")\n";
}
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 2841fe5..f127add 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -2271,6 +2271,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
+ cmListFileLexerSetToken(lexer, 0, 0);
if(lexer->file || lexer->string_buffer)
{
cmListFileLexer_yylex_destroy(lexer->scanner);
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 12b53ee..bd3c1eb 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -292,6 +292,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
+ cmListFileLexerSetToken(lexer, 0, 0);
if(lexer->file || lexer->string_buffer)
{
cmListFileLexer_yylex_destroy(lexer->scanner);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9c04109..b4cb5bd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -297,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles()
this->Makefile->GetProperty("TEST_INCLUDE_FILE");
if ( testIncludeFile )
{
- fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl;
+ fout << "include(\"" << testIncludeFile << "\")" << std::endl;
}
// Ask each test generator to write its code.
@@ -313,7 +313,8 @@ void cmLocalGenerator::GenerateTestFiles()
size_t i;
for(i = 0; i < this->Children.size(); ++i)
{
- fout << "SUBDIRS(";
+ // TODO: Use add_subdirectory instead?
+ fout << "subdirs(";
std::string outP =
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
fout << this->Convert(outP.c_str(),START_OUTPUT);
@@ -416,39 +417,39 @@ void cmLocalGenerator::GenerateInstallRules()
fout << "# Install script for directory: "
<< this->Makefile->GetCurrentDirectory() << std::endl << std::endl;
fout << "# Set the install prefix" << std::endl
- << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
- << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
- << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
- << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX "
+ << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
+ << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
+ << "endif()" << std::endl
+ << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX "
<< "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl
<< std::endl;
// Write support code for generating per-configuration install rules.
fout <<
"# Set the install configuration name.\n"
- "IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
- " IF(BUILD_TYPE)\n"
- " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n"
+ "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
+ " if(BUILD_TYPE)\n"
+ " string(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n"
" CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n"
- " ELSE(BUILD_TYPE)\n"
- " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n"
- " ENDIF(BUILD_TYPE)\n"
- " MESSAGE(STATUS \"Install configuration: "
+ " else()\n"
+ " set(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n"
+ " endif()\n"
+ " message(STATUS \"Install configuration: "
"\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n"
- "ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
+ "endif()\n"
"\n";
// Write support code for dealing with component-specific installs.
fout <<
"# Set the component getting installed.\n"
- "IF(NOT CMAKE_INSTALL_COMPONENT)\n"
- " IF(COMPONENT)\n"
- " MESSAGE(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n"
- " SET(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n"
- " ELSE(COMPONENT)\n"
- " SET(CMAKE_INSTALL_COMPONENT)\n"
- " ENDIF(COMPONENT)\n"
- "ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n"
+ "if(NOT CMAKE_INSTALL_COMPONENT)\n"
+ " if(COMPONENT)\n"
+ " message(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n"
+ " set(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n"
+ " else()\n"
+ " set(CMAKE_INSTALL_COMPONENT)\n"
+ " endif()\n"
+ "endif()\n"
"\n";
// Copy user-specified install options to the install code.
@@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules()
{
fout <<
"# Install shared libraries without execute permission?\n"
- "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
- " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
- "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
+ "endif()\n"
"\n";
}
@@ -479,7 +480,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Include install scripts from subdirectories.
if(!this->Children.empty())
{
- fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
+ fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
for(std::vector<cmLocalGenerator*>::const_iterator
ci = this->Children.begin(); ci != this->Children.end(); ++ci)
@@ -488,34 +489,34 @@ void cmLocalGenerator::GenerateInstallRules()
{
std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ConvertToUnixSlashes(odir);
- fout << " INCLUDE(\"" << odir.c_str()
+ fout << " include(\"" << odir.c_str()
<< "/cmake_install.cmake\")" << std::endl;
}
}
fout << "\n";
- fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n\n";
+ fout << "endif()\n\n";
}
// Record the install manifest.
if ( toplevel_install )
{
fout <<
- "IF(CMAKE_INSTALL_COMPONENT)\n"
- " SET(CMAKE_INSTALL_MANIFEST \"install_manifest_"
+ "if(CMAKE_INSTALL_COMPONENT)\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
"${CMAKE_INSTALL_COMPONENT}.txt\")\n"
- "ELSE(CMAKE_INSTALL_COMPONENT)\n"
- " SET(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
- "ENDIF(CMAKE_INSTALL_COMPONENT)\n\n";
+ "else()\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
+ "endif()\n\n";
fout
- << "FILE(WRITE \""
+ << "file(WRITE \""
<< homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" "
<< "\"\")" << std::endl;
fout
- << "FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl
- << " FILE(APPEND \""
+ << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl
+ << " file(APPEND \""
<< homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" "
<< "\"${file}\\n\")" << std::endl
- << "ENDFOREACH(file)" << std::endl;
+ << "endforeach()" << std::endl;
}
}
@@ -1793,6 +1794,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
ItemVector const& items = cli.GetItems();
for(ItemVector::const_iterator li = items.begin(); li != items.end(); ++li)
{
+ if(li->Target && li->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
if(li->IsPath)
{
linkLibs += this->ConvertToLinkReference(li->Value);
@@ -1996,6 +2001,10 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
// An object library has no single file on which to depend.
// This was listed to get the target-level dependency.
return false;
+ case cmTarget::INTERFACE_LIBRARY:
+ // An interface library has no file on which to depend.
+ // This was listed to get the target-level dependency.
+ return false;
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
// A utility target has no file on which to depend. This was listed
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a522e37..89b05d7 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -17,7 +17,6 @@
#include "cmNinjaTargetGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"
-#include "cmComputeLinkInformation.h"
#include "cmake.h"
#include <assert.h>
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 56da1f9..2443583 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -474,9 +474,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
// Setup relative path conversion tops.
infoFileStream
<< "# Relative path conversion top directories.\n"
- << "SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
+ << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
<< "\")\n"
- << "SET(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
+ << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
<< "\")\n"
<< "\n";
@@ -485,7 +485,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
{
infoFileStream
<< "# Force unix paths in dependencies.\n"
- << "SET(CMAKE_FORCE_UNIX_PATHS 1)\n"
+ << "set(CMAKE_FORCE_UNIX_PATHS 1)\n"
<< "\n";
}
@@ -495,21 +495,21 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
<< "# The C and CXX include file regular expressions for "
<< "this directory.\n";
infoFileStream
- << "SET(CMAKE_C_INCLUDE_REGEX_SCAN ";
+ << "set(CMAKE_C_INCLUDE_REGEX_SCAN ";
this->WriteCMakeArgument(infoFileStream,
this->Makefile->GetIncludeRegularExpression());
infoFileStream
<< ")\n";
infoFileStream
- << "SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
+ << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
this->WriteCMakeArgument(infoFileStream,
this->Makefile->GetComplainRegularExpression());
infoFileStream
<< ")\n";
infoFileStream
- << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n";
+ << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n";
infoFileStream
- << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
+ << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
"${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n";
}
@@ -1176,7 +1176,7 @@ cmLocalUnixMakefileGenerator3
{
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
}
- fout << "FILE(REMOVE_RECURSE\n";
+ fout << "file(REMOVE_RECURSE\n";
std::string remove = "$(CMAKE_COMMAND) -P ";
remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
for(std::vector<std::string>::const_iterator f = files.begin();
@@ -1196,16 +1196,16 @@ cmLocalUnixMakefileGenerator3
target.GetLanguages(languages);
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
- << "FOREACH(lang";
+ << "foreach(lang";
for(std::set<cmStdString>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
fout << " " << *l;
}
fout << ")\n"
- << " INCLUDE(" << this->GetTargetDirectory(target)
+ << " include(" << this->GetTargetDirectory(target)
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
- << "ENDFOREACH(lang)\n";
+ << "endforeach()\n";
}
}
}
@@ -1915,7 +1915,7 @@ void cmLocalUnixMakefileGenerator3
cmakefileStream
<< "# The set of languages for which implicit dependencies are needed:\n";
cmakefileStream
- << "SET(CMAKE_DEPENDS_LANGUAGES\n";
+ << "set(CMAKE_DEPENDS_LANGUAGES\n";
for(ImplicitDependLanguageMap::const_iterator
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
@@ -1930,7 +1930,7 @@ void cmLocalUnixMakefileGenerator3
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
cmakefileStream
- << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
+ << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
ImplicitDependFileMap const& implicitPairs = l->second;
// for each file pair
@@ -1954,7 +1954,7 @@ void cmLocalUnixMakefileGenerator3
if(cid && *cid)
{
cmakefileStream
- << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
+ << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
<< cid << "\")\n";
}
}
@@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3
cmakefileStream
<< "\n"
<< "# Preprocessor definitions for this target.\n"
- << "SET(CMAKE_TARGET_DEFINITIONS\n";
+ << "set(CMAKE_TARGET_DEFINITIONS\n";
for(std::set<std::string>::const_iterator di = defines.begin();
di != defines.end(); ++di)
{
@@ -1995,7 +1995,7 @@ void cmLocalUnixMakefileGenerator3
if(!transformRules.empty())
{
cmakefileStream
- << "SET(CMAKE_INCLUDE_TRANSFORMS\n";
+ << "set(CMAKE_INCLUDE_TRANSFORMS\n";
for(std::vector<std::string>::const_iterator tri = transformRules.begin();
tri != transformRules.end(); ++tri)
{
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index c3789a0..aedd6ed 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -76,6 +76,10 @@ void cmLocalVisualStudio10Generator::Generate()
cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(l->second))
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index e5b4057..a665b93 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -91,6 +91,11 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
+ if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
+
// Add a rule to regenerate the build system when the target
// specification source changes.
const char* suppRegenRule =
@@ -146,8 +151,10 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
case cmTarget::GLOBAL_TARGET:
this->SetBuildType(UTILITY, l->first.c_str(), l->second);
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ continue;
default:
- cmSystemTools::Error("Bad target type", l->first.c_str());
+ cmSystemTools::Error("Bad target type: ", l->first.c_str());
break;
}
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
@@ -165,7 +172,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
dir += l->first.substr(0, pos);
if(!cmSystemTools::MakeDirectory(dir.c_str()))
{
- cmSystemTools::Error("Error creating directory ", dir.c_str());
+ cmSystemTools::Error("Error creating directory: ", dir.c_str());
}
}
this->CreateSingleDSP(l->first.c_str(),l->second);
@@ -1839,7 +1846,8 @@ void cmLocalVisualStudio6Generator
options +=
this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str());
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
options += l->Value;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index bd6c860..64de448 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -78,6 +78,10 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
if(path)
{
@@ -181,6 +185,10 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it
if(!l->second.GetProperty("EXTERNAL_MSPROJECT"))
@@ -1258,6 +1266,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
+ case cmTarget::INTERFACE_LIBRARY:
break;
}
}
@@ -1288,7 +1297,8 @@ cmLocalVisualStudio7GeneratorInternals
cmLocalGenerator::UNCHANGED);
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
fout << l->Value << " ";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 34541e9..40e55c2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1463,6 +1463,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
// if it is not a static or shared library then you can not link to it
if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
(tgt->GetType() == cmTarget::SHARED_LIBRARY) ||
+ (tgt->GetType() == cmTarget::INTERFACE_LIBRARY) ||
tgt->IsExecutableWithExports()))
{
cmOStringStream e;
@@ -1990,6 +1991,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
{
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
+ case cmTarget::INTERFACE_LIBRARY:
return;
default:;
}
@@ -2017,7 +2019,8 @@ cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
if ( (type != cmTarget::STATIC_LIBRARY)
&& (type != cmTarget::SHARED_LIBRARY)
&& (type != cmTarget::MODULE_LIBRARY)
- && (type != cmTarget::OBJECT_LIBRARY))
+ && (type != cmTarget::OBJECT_LIBRARY)
+ && (type != cmTarget::INTERFACE_LIBRARY))
{
this->IssueMessage(cmake::INTERNAL_ERROR,
"cmMakefile::AddLibrary given invalid target type.");
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0829cab..42091e3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmTarget.h"
#include "cmake.h"
#include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
#include "cmMakefileExecutableTargetGenerator.h"
#include "cmMakefileLibraryTargetGenerator.h"
@@ -131,7 +132,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES"))
{
- cmSystemTools::ExpandListArgument(additional_clean_files,
+ const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(additional_clean_files);
+
+ cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config,
+ false, this->Target, 0, 0),
this->CleanFiles);
}
@@ -968,7 +976,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Pairs of files generated by the same build rule.\n"
- << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
+ << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
for(MultipleOutputPairsType::const_iterator pi =
this->MultipleOutputPairs.begin();
pi != this->MultipleOutputPairs.end(); ++pi)
@@ -986,7 +994,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Targets to which this target links.\n"
- << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n";
+ << "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
std::set<cmTarget const*> emitted;
const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
@@ -996,7 +1004,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
i = items.begin(); i != items.end(); ++i)
{
cmTarget const* linkee = i->Target;
- if(linkee && !linkee->IsImported() && emitted.insert(linkee).second)
+ if(linkee && !linkee->IsImported()
+ // We can ignore the INTERFACE_LIBRARY items because
+ // Target->GetLinkInformation already processed their
+ // link interface and they don't have any output themselves.
+ && linkee->GetType() != cmTarget::INTERFACE_LIBRARY
+ && emitted.insert(linkee).second)
{
cmMakefile* mf = linkee->GetMakefile();
cmLocalGenerator* lg = mf->GetLocalGenerator();
@@ -1018,7 +1031,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Fortran module output directory.\n"
- << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
+ << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
}
// Target-specific include directories:
@@ -1026,7 +1039,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "\n"
<< "# The include file search paths:\n";
*this->InfoFileStream
- << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
+ << "set(CMAKE_C_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
@@ -1045,13 +1058,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< " )\n";
*this->InfoFileStream
- << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_CXX_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
*this->InfoFileStream
- << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
*this->InfoFileStream
- << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_ASM_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
// and now write the rule to use it
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 246eb8a..adfc553 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -56,7 +56,7 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n"
+ " mark_as_advanced([CLEAR|FORCE] VAR [VAR2 ...])\n"
"Mark the named cached variables as advanced. An advanced variable "
"will not be displayed in any of the cmake GUIs unless the show "
"advanced option is on. "
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index 6f7b6a9..a7d7429 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -78,7 +78,7 @@ const std::string cmNewLineStyle::GetCharacters() const
return "\r\n";
default:
;
- };
+ }
return "";
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index c3d6a94..1d3469f 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -27,11 +27,11 @@ public:
cmPolicies::PolicyStatus status)
{
if (!idString || !shortDescription || ! longDescription)
- {
+ {
cmSystemTools::Error("Attempt to define a policy without "
"all parameters being specified!");
return;
- }
+ }
this->ID = iD;
this->IDString = idString;
this->ShortDescription = shortDescription;
@@ -61,29 +61,29 @@ public:
unsigned int tweakV)
{
if (majorV < this->MajorVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (majorV > this->MajorVersionIntroduced)
- {
+ {
return false;
- }
+ }
if (minorV < this->MinorVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (minorV > this->MinorVersionIntroduced)
- {
+ {
return false;
- }
+ }
if (patchV < this->PatchVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (patchV > this->PatchVersionIntroduced)
- {
+ {
return false;
- }
+ }
return (tweakV < this->TweakVersionIntroduced);
}
@@ -645,9 +645,9 @@ cmPolicies::~cmPolicies()
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
- {
+ {
delete i->second;
- }
+ }
}
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
@@ -662,11 +662,11 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
{
// a policy must be unique and can only be defined once
if (this->Policies.find(iD) != this->Policies.end())
- {
+ {
cmSystemTools::Error("Attempt to redefine a CMake policy for policy "
"ID ", this->GetPolicyIDString(iD).c_str());
return;
- }
+ }
this->Policies[iD] = new cmPolicy(iD, idString,
shortDescription,
@@ -820,15 +820,15 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy,
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
if (!id || strlen(id) < 1)
- {
+ {
return false;
- }
+ }
std::map<std::string,cmPolicies::PolicyID>::iterator pos =
this->PolicyStringMap.find(id);
if (pos == this->PolicyStringMap.end())
- {
+ {
return false;
- }
+ }
pid = pos->second;
return true;
}
@@ -838,9 +838,9 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(pid);
if (pos == this->Policies.end())
- {
+ {
return "";
- }
+ }
return pos->second->IDString;
}
@@ -851,11 +851,11 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
cmSystemTools::Error(
"Request for warning text for undefined policy!");
return "Request for warning text for undefined policy!";
- }
+ }
cmOStringStream msg;
msg <<
@@ -875,11 +875,11 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
cmSystemTools::Error(
"Request for error text for undefined policy!");
return "Request for error text for undefined policy!";
- }
+ }
cmOStringStream error;
error <<
@@ -905,10 +905,10 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
// TODO is this right?
return cmPolicies::WARN;
- }
+ }
return pos->second->Status;
}
@@ -919,7 +919,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
- {
+ {
cmOStringStream full;
full << i->second->LongDescription;
full << "\nThis policy was introduced in CMake version ";
@@ -956,7 +956,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
i->second->ShortDescription.c_str(),
full.str().c_str());
v.push_back(e);
- }
+ }
}
//----------------------------------------------------------------------------
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 93e39ab..651e0ad 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -32,16 +32,28 @@
#include "cmQtAutomoc.h"
-static bool containsQ_OBJECT(const std::string& text)
+static bool requiresMocing(const std::string& text, std::string &macroName)
{
// this simple check is much much faster than the regexp
- if (strstr(text.c_str(), "Q_OBJECT") == NULL)
+ if (strstr(text.c_str(), "Q_OBJECT") == NULL
+ && strstr(text.c_str(), "Q_GADGET") == NULL)
{
return false;
}
cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
- return qObjectRegExp.find(text);
+ if (qObjectRegExp.find(text))
+ {
+ macroName = "Q_OBJECT";
+ return true;
+ }
+ cmsys::RegularExpression qGadgetRegExp("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
+ if (qGadgetRegExp.find(text))
+ {
+ macroName = "Q_GADGET";
+ return true;
+ }
+ return false;
}
@@ -436,7 +448,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
it = configDefines.begin(), end = configDefines.end();
it != end; ++it)
{
- infoFile << "SET(AM_MOC_COMPILE_DEFINITIONS_" << it->first <<
+ infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first <<
" " << it->second << ")\n";
}
}
@@ -446,7 +458,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
it = configIncludes.begin(), end = configIncludes.end();
it != end; ++it)
{
- infoFile << "SET(AM_MOC_INCLUDES_" << it->first <<
+ infoFile << "set(AM_MOC_INCLUDES_" << it->first <<
" " << it->second << ")\n";
}
}
@@ -837,7 +849,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
const std::string scannedFileBasename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFilename);
- const bool cppContainsQ_OBJECT = containsQ_OBJECT(contentsString);
+ std::string macroName;
+ const bool requiresMoc = requiresMocing(contentsString, macroName);
bool dotMocIncluded = false;
bool mocUnderscoreIncluded = false;
std::string ownMocUnderscoreFile;
@@ -908,7 +921,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
else
{
std::string fileToMoc = absFilename;
- if ((basename != scannedFileBasename) || (cppContainsQ_OBJECT==false))
+ if ((basename != scannedFileBasename) || (requiresMoc==false))
{
std::string mocSubDir = extractSubDir(absPath, currentMoc);
std::string headerToMoc = findMatchingHeader(
@@ -917,12 +930,12 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
// this is for KDE4 compatibility:
fileToMoc = headerToMoc;
- if ((cppContainsQ_OBJECT==false) &&(basename==scannedFileBasename))
+ if ((requiresMoc==false) &&(basename==scannedFileBasename))
{
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
"includes the moc file \"" << currentMoc <<
- "\", but does not contain a Q_OBJECT macro. "
- "Running moc on "
+ "\", but does not contain a " << macroName
+ << " macro. Running moc on "
<< "\"" << headerToMoc << "\" ! Include \"moc_"
<< basename << ".cpp\" for a compatiblity with "
"strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"
@@ -965,13 +978,14 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (cppContainsQ_OBJECT == true))
+ if ((dotMocIncluded == false) && (requiresMoc == true))
{
if (mocUnderscoreIncluded == true)
{
// this is for KDE4 compatibility:
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not "
+ "include "
<< "\"" << scannedFileBasename << ".moc\", but instead "
"includes "
<< "\"" << ownMocUnderscoreFile << "\". Running moc on "
@@ -986,7 +1000,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
// otherwise always error out since it will not compile:
std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not "
+ "include "
<< "\"" << scannedFileBasename << ".moc\" !\n"
<< std::endl;
::exit(EXIT_FAILURE);
@@ -1094,11 +1109,13 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString)))
+ std::string macroName;
+ if ((dotMocIncluded == false) && (requiresMocing(contentsString,
+ macroName)))
{
// otherwise always error out since it will not compile:
std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not include "
<< "\"" << scannedFileBasename << ".moc\" !\n"
<< std::endl;
::exit(EXIT_FAILURE);
@@ -1165,7 +1182,8 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
const std::string currentMoc = "moc_" + basename + ".cpp";
const std::string contents = this->ReadAll(headerName);
- if (containsQ_OBJECT(contents))
+ std::string macroName;
+ if (requiresMocing(contents, macroName))
{
//std::cout << "header contains Q_OBJECT macro";
notIncludedMocs[headerName] = currentMoc;
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index cabe98a..3b6a49b 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -185,9 +185,9 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os,
{
// Generate a per-configuration block.
std::string config_test = this->CreateConfigTest(this->Configurations);
- os << indent << "IF(" << config_test << ")\n";
+ os << indent << "if(" << config_test << ")\n";
this->GenerateScriptActions(os, indent.Next());
- os << indent << "ENDIF(" << config_test << ")\n";
+ os << indent << "endif(" << config_test << ")\n";
}
}
@@ -219,7 +219,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
{
// Generate a per-configuration block.
std::string config_test = this->CreateConfigTest(config);
- os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n";
+ os << indent << (first? "if(" : "elseif(") << config_test << ")\n";
this->GenerateScriptForConfig(os, config, indent.Next());
first = false;
}
@@ -228,10 +228,10 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
{
if(this->NeedsScriptNoConfig())
{
- os << indent << "ELSE()\n";
+ os << indent << "else()\n";
this->GenerateScriptNoConfig(os, indent.Next());
}
- os << indent << "ENDIF()\n";
+ os << indent << "endif()\n";
}
}
}
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 3a59218..f2f2611 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -51,7 +51,8 @@ public:
" set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2"
" value2)\n"
"Set a property for the tests. If the property is not found, CMake "
- "will report an error. The properties include:\n"
+ "will report an error. Generator expressions will be expanded the same "
+ "as supported by the test's add_test call. The properties include:\n"
"WILL_FAIL: If set to true, this will invert the pass/fail flag of the"
" test.\n"
"PASS_REGULAR_EXPRESSION: If set, the test output will be checked "
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ac655da..1c04e4e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -47,6 +47,8 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType)
return "UTILITY";
case cmTarget::GLOBAL_TARGET:
return "GLOBAL_TARGET";
+ case cmTarget::INTERFACE_LIBRARY:
+ return "INTERFACE_LIBRARY";
case cmTarget::UNKNOWN_LIBRARY:
return "UNKNOWN_LIBRARY";
}
@@ -924,10 +926,24 @@ void cmTarget::DefineProperties(cmake *cm)
"The first configuration in the list found to be provided by the "
"imported target is selected. If this property is set and no matching "
"configurations are available, then the imported target is considered "
- "to be not found. This property is ignored for non-imported targets.",
+ "to be not found. This property is ignored for non-imported targets.\n"
+ "This property is initialized by the value of the variable "
+ "CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is "
+ "created.",
false /* TODO: make this chained */ );
cm->DefineProperty
+ ("NO_SYSTEM_FROM_IMPORTED", cmProperty::TARGET,
+ "Do not treat includes from IMPORTED target interfaces as SYSTEM.",
+ "The contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED targets "
+ "are treated as SYSTEM includes by default. If this property is "
+ "enabled, the contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED "
+ "targets are not treated as system includes. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_NO_SYSTEM_FROM_IMPORTED if it is set when a target is "
+ "created.");
+
+ cm->DefineProperty
("OSX_ARCHITECTURES", cmProperty::TARGET,
"Target specific architectures for OS X.",
"The OSX_ARCHITECTURES property sets the target binary architecture "
@@ -1637,6 +1653,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
this->SetPropertyDefault("MACOSX_BUNDLE", 0);
this->SetPropertyDefault("MACOSX_RPATH", 0);
+ this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
// Collect the set of configuration types.
@@ -1649,6 +1666,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
"LIBRARY_OUTPUT_DIRECTORY_",
"RUNTIME_OUTPUT_DIRECTORY_",
"PDB_OUTPUT_DIRECTORY_",
+ "MAP_IMPORTED_CONFIG_",
0};
for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
@@ -1727,6 +1745,14 @@ void cmTarget::SetMakefile(cmMakefile* mf)
CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
#undef CAPTURE_TARGET_POLICY
+
+ if (this->TargetTypeValue == INTERFACE_LIBRARY)
+ {
+ // This policy is checked in a few conditions. The properties relevant
+ // to the policy are always ignored for INTERFACE_LIBRARY targets,
+ // so ensure that the conditions don't lead to nonsense.
+ this->PolicyStatusCMP0022 = cmPolicies::NEW;
+ }
}
//----------------------------------------------------------------------------
@@ -1792,6 +1818,7 @@ bool cmTarget::IsLinkable()
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY ||
+ this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
@@ -2563,8 +2590,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
return;
}
- {
cmTarget *tgt = this->Makefile->FindTargetToUse(lib);
+ {
const bool isNonImportedTarget = tgt && !tgt->IsImported();
const std::string libName = (isNonImportedTarget && llt != GENERAL)
@@ -2575,7 +2602,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
llt).c_str());
}
- if (cmGeneratorExpression::Find(lib) != std::string::npos)
+ if (cmGeneratorExpression::Find(lib) != std::string::npos
+ || (tgt && tgt->GetType() == INTERFACE_LIBRARY))
{
return;
}
@@ -2657,6 +2685,11 @@ void cmTarget::FinalizeSystemIncludeDirectories()
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
@@ -2664,10 +2697,28 @@ void cmTarget::FinalizeSystemIncludeDirectories()
ge.Parse(it->Value);
std::string targetName = cge->Evaluate(this->Makefile, 0,
false, this, 0, 0);
- if (!this->Makefile->FindTargetToUse(targetName.c_str()))
+ cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str());
+ if (!tgt)
{
continue;
}
+ if (tgt->IsImported()
+ && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")
+ && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"))
+ {
+ std::string includeGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
+ }
+ this->SystemIncludeDirectories.insert(includeGenex);
+ return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset
+ // of the INTERFACE_INCLUDE_DIRECTORIES
+ }
}
std::string includeGenex = "$<TARGET_PROPERTY:" +
it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
@@ -3033,15 +3084,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
this->Internal->LinkInterfacePropertyEntries.clear();
- if (cmGeneratorExpression::IsValidTargetName(value)
- || cmGeneratorExpression::Find(value) != std::string::npos)
- {
- cmListFileBacktrace lfbt;
- this->Makefile->GetBacktrace(lfbt);
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
- }
- // Fall through
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ return;
}
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop);
@@ -3099,15 +3146,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
}
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
- if (cmGeneratorExpression::IsValidTargetName(value)
- || cmGeneratorExpression::Find(value) != std::string::npos)
- {
- cmListFileBacktrace lfbt;
- this->Makefile->GetBacktrace(lfbt);
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
- }
- // Fall through
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ return;
}
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
@@ -3387,6 +3430,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -3585,6 +3633,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -3693,6 +3746,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -4091,6 +4149,7 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
if(strcmp(prop,"LOCATION") == 0)
@@ -4115,7 +4174,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
else
{
- // Support "<CONFIG>_LOCATION" for compatiblity.
+ // Support "<CONFIG>_LOCATION" for compatibility.
int len = static_cast<int>(strlen(prop));
if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
{
@@ -4181,6 +4240,22 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
+ if(strcmp(prop,"LINK_LIBRARIES") == 0)
+ {
+ static std::string output;
+ output = "";
+ std::string sep;
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfacePropertyEntries.begin(),
+ end = this->Internal->LinkInterfacePropertyEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += it->Value;
+ sep = ";";
+ }
+ return output.c_str();
+ }
if (strcmp(prop,"IMPORTED") == 0)
{
@@ -5999,6 +6074,10 @@ cmTarget::GetImportInfo(const char* config, cmTarget *headTarget)
i = this->Internal->ImportInfoMap.insert(entry).first;
}
+ if(this->GetType() == INTERFACE_LIBRARY)
+ {
+ return &i->second;
+ }
// If the location is empty then the target is not available for
// this configuration.
if(i->second.Location.empty() && i->second.ImportLibrary.empty())
@@ -6147,7 +6226,51 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
const char* loc = 0;
const char* imp = 0;
std::string suffix;
- if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix))
+ if (this->GetType() != INTERFACE_LIBRARY &&
+ !this->GetMappedConfig(desired_config, &loc, &imp, suffix))
+ {
+ return;
+ }
+
+ // Get the link interface.
+ {
+ std::string linkProp = "INTERFACE_LINK_LIBRARIES";
+ const char *propertyLibs = this->GetProperty(linkProp.c_str());
+
+ if (this->GetType() != INTERFACE_LIBRARY)
+ {
+ if(!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ linkProp += suffix;
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+
+ if(!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+ }
+ if(propertyLibs)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ linkProp, 0, 0);
+ cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
+ ->Evaluate(this->Makefile,
+ desired_config.c_str(),
+ false,
+ headTarget,
+ this,
+ &dagChecker),
+ info.LinkInterface.Libraries);
+ }
+ }
+ if(this->GetType() == INTERFACE_LIBRARY)
{
return;
}
@@ -6224,42 +6347,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
}
- // Get the link interface.
- {
- std::string linkProp = "INTERFACE_LINK_LIBRARIES";
- const char *propertyLibs = this->GetProperty(linkProp.c_str());
-
- if (!propertyLibs)
- {
- linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- linkProp += suffix;
- propertyLibs = this->GetProperty(linkProp.c_str());
- }
-
- if(!propertyLibs)
- {
- linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- propertyLibs = this->GetProperty(linkProp.c_str());
- }
- if(propertyLibs)
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- linkProp, 0, 0);
- cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
- ->Evaluate(this->Makefile,
- desired_config.c_str(),
- false,
- headTarget,
- this,
- &dagChecker),
- info.LinkInterface.Libraries);
- }
- }
-
// Get the link dependencies.
{
std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES";
@@ -6520,6 +6607,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
}
+ else if (this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ }
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
@@ -6547,7 +6639,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
this, &dagChecker), iface.Libraries);
if(this->GetType() == cmTarget::SHARED_LIBRARY
- || this->GetType() == cmTarget::STATIC_LIBRARY)
+ || this->GetType() == cmTarget::STATIC_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
{
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
@@ -6823,7 +6916,7 @@ void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee,
pi != props.end(); ++pi)
{
if (depender->GetMakefile()->GetCMakeInstance()
- ->GetIsPropertyDefined(pi->c_str(),
+ ->IsPropertyDefined(pi->c_str(),
cmProperty::TARGET))
{
cmOStringStream e;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 27b74ca..a88c5ec 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -72,6 +72,7 @@ public:
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
SHARED_LIBRARY, MODULE_LIBRARY,
OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET,
+ INTERFACE_LIBRARY,
UNKNOWN_LIBRARY};
static const char* GetTargetTypeName(TargetType targetType);
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
@@ -372,7 +373,7 @@ public:
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const char* config);
- /** Whether this library has @rpath and platform supports it. */
+ /** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpath(const char* config);
/** Test for special case of a third-party shared library that has
@@ -421,12 +422,12 @@ public:
bool IsChrpathUsed(const char* config);
/** Return the install name directory for the target in the
- * build tree. For example: "@rpath/", "@loader_path/",
+ * build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std::string GetInstallNameDirForBuildTree(const char* config);
/** Return the install name directory for the target in the
- * install tree. For example: "@rpath/" or "@loader_path/". */
+ * install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree();
cmComputeLinkInformation* GetLinkInformation(const char* config,
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 863b391..22f6a03 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -322,6 +322,15 @@ bool
cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
+ if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+ && this->CurrentProcessingState != ProcessingKeywordLinkInterface)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "INTERFACE library can only be used with the INTERFACE keyword of "
+ "target_link_libraries");
+ return false;
+ }
+
cmTarget::TLLSignature sig =
(this->CurrentProcessingState == ProcessingPlainPrivateInterface
|| this->CurrentProcessingState == ProcessingPlainPublicInterface
@@ -407,6 +416,11 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
return true;
}
+ if (this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return true;
+ }
+
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 1862cb6..e7b6999 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -47,6 +47,7 @@ bool cmTargetPropCommandBase
&& (this->Target->GetType() != cmTarget::STATIC_LIBRARY)
&& (this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
&& (this->Target->GetType() != cmTarget::MODULE_LIBRARY)
+ && (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
&& (this->Target->GetType() != cmTarget::EXECUTABLE))
{
this->SetError("called with non-compilable target type");
@@ -112,6 +113,14 @@ bool cmTargetPropCommandBase
return false;
}
+ if (this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+ && scope != "INTERFACE")
+ {
+ this->SetError("may only be set INTERFACE properties on INTERFACE "
+ "targets");
+ return false;
+ }
+
++argIndex;
std::vector<std::string> content;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 42f511e..d962fb2 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -39,29 +39,8 @@ cmTestGenerator
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
Indent const& indent)
{
- // First create the tests.
+ // Create the tests.
this->cmScriptGenerator::GenerateScriptConfigs(os, indent);
-
- // Now generate the test properties.
- if(this->TestGenerated)
- {
- cmTest* test = this->Test;
- cmMakefile* mf = test->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
- std::ostream& fout = os;
- cmPropertyMap::const_iterator pit;
- cmPropertyMap* mpit = &test->GetProperties();
- if ( mpit->size() )
- {
- fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES ";
- for ( pit = mpit->begin(); pit != mpit->end(); ++ pit )
- {
- fout << " " << pit->first
- << " " << lg->EscapeForCMake(pit->second.GetValue());
- }
- fout << ")" << std::endl;
- }
- }
}
//----------------------------------------------------------------------------
@@ -94,7 +73,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
- os << indent << "ADD_TEST(" << this->Test->GetName() << " ";
+ os << indent << "add_test(" << this->Test->GetName() << " ";
// Get the test command line to be executed.
std::vector<std::string> const& command = this->Test->GetCommand();
@@ -127,13 +106,29 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Finish the test command.
os << ")\n";
+
+ // Output properties for the test.
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ os << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ os << " " << i->first
+ << " " << lg->EscapeForCMake(
+ ge.Parse(i->second.GetValue())->Evaluate(mf, config));
+ }
+ os << ")" << std::endl;
+ }
}
//----------------------------------------------------------------------------
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
Indent const& indent)
{
- os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
+ os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
}
//----------------------------------------------------------------------------
@@ -157,7 +152,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
fout << indent;
- fout << "ADD_TEST(";
+ fout << "add_test(";
fout << this->Test->GetName() << " \"" << exe << "\"";
for(std::vector<std::string>::const_iterator argit = command.begin()+1;
@@ -181,4 +176,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
fout << "\"";
}
fout << ")" << std::endl;
+
+ // Output properties for the test.
+ cmMakefile* mf = this->Test->GetMakefile();
+ cmLocalGenerator* lg = mf->GetLocalGenerator();
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ fout << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ fout << " " << i->first
+ << " " << lg->EscapeForCMake(i->second.GetValue());
+ }
+ fout << ")" << std::endl;
+ }
}
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 4fc0b13..879d4fd 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -353,13 +353,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
file << comment << "\n\n";
- file << "SET( " << this->RunResultVariable << " \n \""
+ file << "set( " << this->RunResultVariable << " \n \""
<< this->Makefile->GetDefinition(this->RunResultVariable.c_str())
<< "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n";
if (out!=0)
{
- file << "SET( " << internalRunOutputName << " \n \""
+ file << "set( " << internalRunOutputName << " \n \""
<< this->Makefile->GetDefinition(internalRunOutputName.c_str())
<< "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n";
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a26b291..0dbb5eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -490,6 +490,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
break;
case cmTarget::GLOBAL_TARGET:
case cmTarget::UNKNOWN_LIBRARY:
+ case cmTarget::INTERFACE_LIBRARY:
break;
}
configType += "</ConfigurationType>\n";
@@ -1701,7 +1702,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
libstring += sep;
libstring += path;
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
libstring += sep;
libstring += l->Value;
@@ -1836,6 +1838,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// skip fortran targets as they can not be processed by MSBuild
// the only reference will be in the .sln file
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 290aff0..2249323 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmake.h"
#include "cmDocumentVariables.h"
-#include "time.h"
#include "cmCacheManager.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
@@ -19,23 +18,15 @@
#include "cmCommands.h"
#include "cmCommand.h"
#include "cmFileTimeComparison.h"
-#include "cmGeneratedFileStream.h"
-#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
-#include "cmVersion.h"
#include "cmTest.h"
#include "cmDocumentationFormatterText.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGraphVizWriter.h"
-# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmVariableWatch.h"
-# include <cmsys/Terminal.h>
-# include <cmsys/CommandLineArguments.hxx>
#endif
-#include <cmsys/Directory.hxx>
-#include <cmsys/Process.h>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -74,18 +65,11 @@
# endif
# include "cmGlobalMSYSMakefileGenerator.h"
# include "cmGlobalMinGWMakefileGenerator.h"
-# include "cmWin32ProcessExecution.h"
#else
#endif
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmGlobalNinjaGenerator.h"
-
-#if defined(CMAKE_HAVE_VS_GENERATORS)
-#include "cmCallVisualStudioMacro.h"
-#include "cmVisualStudioWCEPlatformParser.h"
-#endif
-
#if !defined(CMAKE_BOOT_MINGW)
# include "cmExtraCodeBlocksGenerator.h"
#endif
@@ -1132,737 +1116,6 @@ int cmake::AddCMakePaths()
return 1;
}
-
-
-void CMakeCommandUsage(const char* program)
-{
- cmOStringStream errorStream;
-
-#ifdef CMAKE_BUILD_WITH_CMAKE
- errorStream
- << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
-#else
- errorStream
- << "cmake bootstrap\n";
-#endif
- // If you add new commands, change here,
- // and in cmakemain.cxx in the options table
- errorStream
- << "Usage: " << program << " -E [command] [arguments ...]\n"
- << "Available commands: \n"
- << " chdir dir cmd [args]... - run command in a given directory\n"
- << " compare_files file1 file2 - check if file1 is same as file2\n"
- << " copy file destination - copy file to destination (either file "
- "or directory)\n"
- << " copy_directory source destination - copy directory 'source' "
- "content to directory 'destination'\n"
- << " copy_if_different in-file out-file - copy file if input has "
- "changed\n"
- << " echo [string]... - displays arguments as text\n"
- << " echo_append [string]... - displays arguments as text but no new "
- "line\n"
- << " environment - display the current environment\n"
- << " make_directory dir - create a directory\n"
- << " md5sum file1 [...] - compute md5sum of files\n"
- << " remove [-f] file1 file2 ... - remove the file(s), use -f to force "
- "it\n"
- << " remove_directory dir - remove a directory and its contents\n"
- << " rename oldname newname - rename a file or directory "
- "(on one volume)\n"
- << " tar [cxt][vfz][cvfj] file.tar [file/dir1 file/dir2 ...]\n"
- << " - create or extract a tar or zip archive\n"
- << " time command [args] ... - run command and return elapsed time\n"
- << " touch file - touch a file.\n"
- << " touch_nocreate file - touch a file but do not create it.\n"
-#if defined(_WIN32) && !defined(__CYGWIN__)
- << "Available on Windows only:\n"
- << " comspec - on windows 9x use this for RunCommand\n"
- << " delete_regv key - delete registry value\n"
- << " env_vs8_wince sdkname - displays a batch file which sets the "
- "environment for the provided Windows CE SDK installed in VS2005\n"
- << " env_vs9_wince sdkname - displays a batch file which sets the "
- "environment for the provided Windows CE SDK installed in VS2008\n"
- << " write_regv key value - write registry value\n"
-#else
- << "Available on UNIX only:\n"
- << " create_symlink old new - create a symbolic link new -> old\n"
-#endif
- ;
-
- cmSystemTools::Error(errorStream.str().c_str());
-}
-
-int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
-{
- // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx
- if (args.size() > 1)
- {
- // Copy file
- if (args[1] == "copy" && args.size() == 4)
- {
- if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Error copying file \"" << args[2].c_str()
- << "\" to \"" << args[3].c_str() << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Copy file if different.
- if (args[1] == "copy_if_different" && args.size() == 4)
- {
- if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(),
- args[3].c_str()))
- {
- std::cerr << "Error copying file (if different) from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Copy directory content
- if (args[1] == "copy_directory" && args.size() == 4)
- {
- if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Error copying directory from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Rename a file or directory
- if (args[1] == "rename" && args.size() == 4)
- {
- if(!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str()))
- {
- std::string e = cmSystemTools::GetLastSystemError();
- std::cerr << "Error renaming from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\": " << e << "\n";
- return 1;
- }
- return 0;
- }
-
- // Compare files
- if (args[1] == "compare_files" && args.size() == 4)
- {
- if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Files \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\" are different.\n";
- return 1;
- }
- return 0;
- }
-
- // Echo string
- else if (args[1] == "echo" )
- {
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
- std::cout << std::endl;
- return 0;
- }
-
- // Echo string no new line
- else if (args[1] == "echo_append" )
- {
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
- return 0;
- }
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Command to create a symbolic link. Fails on platforms not
- // supporting them.
- else if (args[1] == "environment" )
- {
- std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
- std::vector<std::string>::iterator it;
- for ( it = env.begin(); it != env.end(); ++ it )
- {
- std::cout << it->c_str() << std::endl;
- }
- return 0;
- }
-#endif
-
- else if (args[1] == "make_directory" && args.size() == 3)
- {
- if(!cmSystemTools::MakeDirectory(args[2].c_str()))
- {
- std::cerr << "Error making directory \"" << args[2].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- else if (args[1] == "remove_directory" && args.size() == 3)
- {
- if(cmSystemTools::FileIsDirectory(args[2].c_str()) &&
- !cmSystemTools::RemoveADirectory(args[2].c_str()))
- {
- std::cerr << "Error removing directory \"" << args[2].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Remove file
- else if (args[1] == "remove" && args.size() > 2)
- {
- bool force = false;
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- if(args[cc] == "\\-f" || args[cc] == "-f")
- {
- force = true;
- }
- else
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force &&
- cmSystemTools::FileExists(args[cc].c_str()))
- {
- return 1;
- }
- }
- }
- return 0;
- }
- // Touch file
- else if (args[1] == "touch" && args.size() > 2)
- {
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::Touch(args[cc].c_str(), true))
- {
- return 1;
- }
- }
- return 0;
- }
- // Touch file
- else if (args[1] == "touch_nocreate" && args.size() > 2)
- {
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::Touch(args[cc].c_str(), false))
- {
- return 1;
- }
- }
- return 0;
- }
-
- // Clock command
- else if (args[1] == "time" && args.size() > 2)
- {
- std::string command = args[2];
- for (std::string::size_type cc = 3; cc < args.size(); cc ++)
- {
- command += " ";
- command += args[cc];
- }
-
- clock_t clock_start, clock_finish;
- time_t time_start, time_finish;
-
- time(&time_start);
- clock_start = clock();
- int ret =0;
- cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret);
-
- clock_finish = clock();
- time(&time_finish);
-
- double clocks_per_sec = static_cast<double>(CLOCKS_PER_SEC);
- std::cout << "Elapsed time: "
- << static_cast<long>(time_finish - time_start) << " s. (time)"
- << ", "
- << static_cast<double>(clock_finish - clock_start) / clocks_per_sec
- << " s. (clock)"
- << "\n";
- return ret;
- }
- // Command to calculate the md5sum of a file
- else if (args[1] == "md5sum" && args.size() >= 3)
- {
- char md5out[32];
- int retval = 0;
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- const char *filename = args[cc].c_str();
- // Cannot compute md5sum of a directory
- if(cmSystemTools::FileIsDirectory(filename))
- {
- std::cerr << "Error: " << filename << " is a directory" << std::endl;
- retval++;
- }
- else if(!cmSystemTools::ComputeFileMD5(filename, md5out))
- {
- // To mimic md5sum behavior in a shell:
- std::cerr << filename << ": No such file or directory" << std::endl;
- retval++;
- }
- else
- {
- std::cout << std::string(md5out,32) << " " << filename << std::endl;
- }
- }
- return retval;
- }
-
- // Command to change directory and run a program.
- else if (args[1] == "chdir" && args.size() >= 4)
- {
- std::string directory = args[2];
- if(!cmSystemTools::FileExists(directory.c_str()))
- {
- cmSystemTools::Error("Directory does not exist for chdir command: ",
- args[2].c_str());
- return 1;
- }
-
- std::string command = "\"";
- command += args[3];
- command += "\"";
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
- {
- command += " \"";
- command += args[cc];
- command += "\"";
- }
- int retval = 0;
- int timeout = 0;
- if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
- directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) )
- {
- return retval;
- }
-
- return 1;
- }
-
- // Command to start progress for a build
- else if (args[1] == "cmake_progress_start" && args.size() == 4)
- {
- // basically remove the directory
- std::string dirName = args[2];
- dirName += "/Progress";
- cmSystemTools::RemoveADirectory(dirName.c_str());
-
- // is the last argument a filename that exists?
- FILE *countFile = fopen(args[3].c_str(),"r");
- int count;
- if (countFile)
- {
- if (1!=fscanf(countFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from count file.");
- }
- fclose(countFile);
- }
- else
- {
- count = atoi(args[3].c_str());
- }
- if (count)
- {
- cmSystemTools::MakeDirectory(dirName.c_str());
- // write the count into the directory
- std::string fName = dirName;
- fName += "/count.txt";
- FILE *progFile = fopen(fName.c_str(),"w");
- if (progFile)
- {
- fprintf(progFile,"%i\n",count);
- fclose(progFile);
- }
- }
- return 0;
- }
-
- // Command to report progress for a build
- else if (args[1] == "cmake_progress_report" && args.size() >= 3)
- {
- std::string dirName = args[2];
- dirName += "/Progress";
- std::string fName;
- FILE *progFile;
-
- // read the count
- fName = dirName;
- fName += "/count.txt";
- progFile = fopen(fName.c_str(),"r");
- int count = 0;
- if (!progFile)
- {
- return 0;
- }
- else
- {
- if (1!=fscanf(progFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from progress file.");
- }
- fclose(progFile);
- }
- unsigned int i;
- for (i = 3; i < args.size(); ++i)
- {
- fName = dirName;
- fName += "/";
- fName += args[i];
- progFile = fopen(fName.c_str(),"w");
- if (progFile)
- {
- fprintf(progFile,"empty");
- fclose(progFile);
- }
- }
- int fileNum = static_cast<int>
- (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
- if (count > 0)
- {
- // print the progress
- fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
- }
- return 0;
- }
-
- // Command to create a symbolic link. Fails on platforms not
- // supporting them.
- else if (args[1] == "create_symlink" && args.size() == 4)
- {
- const char* destinationFileName = args[3].c_str();
- if ( cmSystemTools::FileExists(destinationFileName) )
- {
- if ( cmSystemTools::FileIsSymlink(destinationFileName) )
- {
- if ( !cmSystemTools::RemoveFile(destinationFileName) ||
- cmSystemTools::FileExists(destinationFileName) )
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
- return cmSystemTools::CreateSymlink(args[2].c_str(),
- args[3].c_str())? 0:1;
- }
-
- // Internal CMake shared library support.
- else if (args[1] == "cmake_symlink_library" && args.size() == 5)
- {
- return cmake::SymlinkLibrary(args);
- }
- // Internal CMake versioned executable support.
- else if (args[1] == "cmake_symlink_executable" && args.size() == 4)
- {
- return cmake::SymlinkExecutable(args);
- }
-
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- // Internal CMake support for calling Visual Studio macros.
- else if (args[1] == "cmake_call_visual_studio_macro" && args.size() >= 4)
- {
- // args[2] = full path to .sln file or "ALL"
- // args[3] = name of Visual Studio macro to call
- // args[4..args.size()-1] = [optional] args for Visual Studio macro
-
- std::string macroArgs;
-
- if (args.size() > 4)
- {
- macroArgs = args[4];
-
- for (size_t i = 5; i < args.size(); ++i)
- {
- macroArgs += " ";
- macroArgs += args[i];
- }
- }
-
- return cmCallVisualStudioMacro::CallMacro(args[2], args[3],
- macroArgs, true);
- }
-#endif
-
- // Internal CMake dependency scanning support.
- else if (args[1] == "cmake_depends" && args.size() >= 6)
- {
- // Use the make system's VERBOSE environment variable to enable
- // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
- // (which is set by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
- && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
-
- // Create a cmake object instance to process dependencies.
- cmake cm;
- std::string gen;
- std::string homeDir;
- std::string startDir;
- std::string homeOutDir;
- std::string startOutDir;
- std::string depInfo;
- bool color = false;
- if(args.size() >= 8)
- {
- // Full signature:
- //
- // -E cmake_depends <generator>
- // <home-src-dir> <start-src-dir>
- // <home-out-dir> <start-out-dir>
- // <dep-info> [--color=$(COLOR)]
- //
- // All paths are provided.
- gen = args[2];
- homeDir = args[3];
- startDir = args[4];
- homeOutDir = args[5];
- startOutDir = args[6];
- depInfo = args[7];
- if(args.size() >= 9 &&
- args[8].length() >= 8 &&
- args[8].substr(0, 8) == "--color=")
- {
- // Enable or disable color based on the switch value.
- color = (args[8].size() == 8 ||
- cmSystemTools::IsOn(args[8].substr(8).c_str()));
- }
- }
- else
- {
- // Support older signature for existing makefiles:
- //
- // -E cmake_depends <generator>
- // <home-out-dir> <start-out-dir>
- // <dep-info>
- //
- // Just pretend the source directories are the same as the
- // binary directories so at least scanning will work.
- gen = args[2];
- homeDir = args[3];
- startDir = args[4];
- homeOutDir = args[3];
- startOutDir = args[3];
- depInfo = args[5];
- }
-
- // Create a local generator configured for the directory in
- // which dependencies will be scanned.
- homeDir = cmSystemTools::CollapseFullPath(homeDir.c_str());
- startDir = cmSystemTools::CollapseFullPath(startDir.c_str());
- homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str());
- startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str());
- cm.SetHomeDirectory(homeDir.c_str());
- cm.SetStartDirectory(startDir.c_str());
- cm.SetHomeOutputDirectory(homeOutDir.c_str());
- cm.SetStartOutputDirectory(startOutDir.c_str());
- if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str()))
- {
- cm.SetGlobalGenerator(ggd);
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
- lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
- lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
- lgd->GetMakefile()->MakeStartDirectoriesCurrent();
-
- // Actually scan dependencies.
- return lgd->UpdateDependencies(depInfo.c_str(),
- verbose, color)? 0 : 2;
- }
- return 1;
- }
-
- // Internal CMake link script support.
- else if (args[1] == "cmake_link_script" && args.size() >= 3)
- {
- return cmake::ExecuteLinkScript(args);
- }
-
- // Internal CMake unimplemented feature notification.
- else if (args[1] == "cmake_unimplemented_variable")
- {
- std::cerr << "Feature not implemented for this platform.";
- if(args.size() == 3)
- {
- std::cerr << " Variable " << args[2] << " is not set.";
- }
- std::cerr << std::endl;
- return 1;
- }
- else if (args[1] == "vs_link_exe")
- {
- return cmake::VisualStudioLink(args, 1);
- }
- else if (args[1] == "vs_link_dll")
- {
- return cmake::VisualStudioLink(args, 2);
- }
-#ifdef CMAKE_BUILD_WITH_CMAKE
- // Internal CMake color makefile support.
- else if (args[1] == "cmake_echo_color")
- {
- return cmake::ExecuteEchoColor(args);
- }
- else if (args[1] == "cmake_automoc")
- {
- cmQtAutomoc automoc;
- const char *config = args[3].empty() ? 0 : args[3].c_str();
- bool automocSuccess = automoc.Run(args[2].c_str(), config);
- return automocSuccess ? 0 : 1;
- }
-#endif
-
- // Tar files
- else if (args[1] == "tar" && args.size() > 3)
- {
- std::string flags = args[2];
- std::string outFile = args[3];
- std::vector<cmStdString> files;
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
- {
- files.push_back(args[cc]);
- }
- bool gzip = false;
- bool bzip2 = false;
- bool verbose = false;
- if ( flags.find_first_of('j') != flags.npos )
- {
- bzip2 = true;
- }
- if ( flags.find_first_of('z') != flags.npos )
- {
- gzip = true;
- }
- if ( flags.find_first_of('v') != flags.npos )
- {
- verbose = true;
- }
-
- if ( flags.find_first_of('t') != flags.npos )
- {
- if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
- {
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
- return 1;
- }
- }
- else if ( flags.find_first_of('c') != flags.npos )
- {
- if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, gzip, bzip2, verbose) )
- {
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
- return 1;
- }
- }
- else if ( flags.find_first_of('x') != flags.npos )
- {
- if ( !cmSystemTools::ExtractTar(
- outFile.c_str(), gzip, verbose) )
- {
- cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
- return 1;
- }
-#ifdef WIN32
- // OK, on windows 7 after we untar some files,
- // sometimes we can not rename the directory after
- // the untar is done. This breaks the external project
- // untar and rename code. So, by default we will wait
- // 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
- // is set in the env, its value will be used instead of 100.
- int delay = 100;
- const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
- if(delayVar)
- {
- delay = atoi(delayVar);
- }
- if(delay)
- {
- cmSystemTools::Delay(delay);
- }
-#endif
- }
- return 0;
- }
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Internal CMake Fortran module support.
- else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4)
- {
- return cmDependsFortran::CopyModule(args)? 0 : 1;
- }
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
- // Write registry value
- else if (args[1] == "write_regv" && args.size() > 3)
- {
- return cmSystemTools::WriteRegistryValue(args[2].c_str(),
- args[3].c_str()) ? 0 : 1;
- }
-
- // Delete registry value
- else if (args[1] == "delete_regv" && args.size() > 2)
- {
- return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
- }
- // Remove file
- else if (args[1] == "comspec" && args.size() > 2)
- {
- unsigned int cc;
- std::string command = args[2];
- for ( cc = 3; cc < args.size(); cc ++ )
- {
- command += " " + args[cc];
- }
- return cmWin32ProcessExecution::Windows9xHack(command.c_str());
- }
- else if (args[1] == "env_vs8_wince" && args.size() == 3)
- {
- return cmake::WindowsCEEnvironment("8.0", args[2]);
- }
- else if (args[1] == "env_vs9_wince" && args.size() == 3)
- {
- return cmake::WindowsCEEnvironment("9.0", args[2]);
- }
-#endif
- }
-
- ::CMakeCommandUsage(args[0].c_str());
- return 1;
-}
-
void cmake::AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction)
{
@@ -2437,11 +1690,6 @@ int cmake::ActualConfigure()
{
this->CacheManager->SaveCache(this->GetHomeOutputDirectory());
}
- if ( !this->GraphVizFile.empty() )
- {
- std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl;
- this->GenerateGraphViz(this->GraphVizFile.c_str());
- }
if(cmSystemTools::GetErrorOccuredFlag())
{
return -1;
@@ -2604,6 +1852,11 @@ int cmake::Generate()
return -1;
}
this->GlobalGenerator->Generate();
+ if ( !this->GraphVizFile.empty() )
+ {
+ std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl;
+ this->GenerateGraphViz(this->GraphVizFile.c_str());
+ }
if(this->WarnUnusedCli)
{
this->RunCheckForUnusedVariables();
@@ -3169,264 +2422,6 @@ void cmake::GenerateGraphViz(const char* fileName) const
#endif
}
-
-//----------------------------------------------------------------------------
-int cmake::SymlinkLibrary(std::vector<std::string>& args)
-{
- int result = 0;
- std::string realName = args[2];
- std::string soName = args[3];
- std::string name = args[4];
- if(soName != realName)
- {
- if(!cmake::SymlinkInternal(realName, soName))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
- result = 1;
- }
- }
- if(name != soName)
- {
- if(!cmake::SymlinkInternal(soName, name))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
- result = 1;
- }
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-int cmake::SymlinkExecutable(std::vector<std::string>& args)
-{
- int result = 0;
- std::string realName = args[2];
- std::string name = args[3];
- if(name != realName)
- {
- if(!cmake::SymlinkInternal(realName, name))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
- result = 1;
- }
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-bool cmake::SymlinkInternal(std::string const& file, std::string const& link)
-{
- if(cmSystemTools::FileExists(link.c_str()) ||
- cmSystemTools::FileIsSymlink(link.c_str()))
- {
- cmSystemTools::RemoveFile(link.c_str());
- }
-#if defined(_WIN32) && !defined(__CYGWIN__)
- return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
-#else
- std::string linktext = cmSystemTools::GetFilenameName(file);
- return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
-#endif
-}
-
-//----------------------------------------------------------------------------
-#ifdef CMAKE_BUILD_WITH_CMAKE
-int cmake::ExecuteEchoColor(std::vector<std::string>& args)
-{
- // The arguments are
- // argv[0] == <cmake-executable>
- // argv[1] == cmake_echo_color
-
- bool enabled = true;
- int color = cmsysTerminal_Color_Normal;
- bool newline = true;
- for(unsigned int i=2; i < args.size(); ++i)
- {
- if(args[i].find("--switch=") == 0)
- {
- // Enable or disable color based on the switch value.
- std::string value = args[i].substr(9);
- if(!value.empty())
- {
- if(cmSystemTools::IsOn(value.c_str()))
- {
- enabled = true;
- }
- else
- {
- enabled = false;
- }
- }
- }
- else if(args[i] == "--normal")
- {
- color = cmsysTerminal_Color_Normal;
- }
- else if(args[i] == "--black")
- {
- color = cmsysTerminal_Color_ForegroundBlack;
- }
- else if(args[i] == "--red")
- {
- color = cmsysTerminal_Color_ForegroundRed;
- }
- else if(args[i] == "--green")
- {
- color = cmsysTerminal_Color_ForegroundGreen;
- }
- else if(args[i] == "--yellow")
- {
- color = cmsysTerminal_Color_ForegroundYellow;
- }
- else if(args[i] == "--blue")
- {
- color = cmsysTerminal_Color_ForegroundBlue;
- }
- else if(args[i] == "--magenta")
- {
- color = cmsysTerminal_Color_ForegroundMagenta;
- }
- else if(args[i] == "--cyan")
- {
- color = cmsysTerminal_Color_ForegroundCyan;
- }
- else if(args[i] == "--white")
- {
- color = cmsysTerminal_Color_ForegroundWhite;
- }
- else if(args[i] == "--bold")
- {
- color |= cmsysTerminal_Color_ForegroundBold;
- }
- else if(args[i] == "--no-newline")
- {
- newline = false;
- }
- else if(args[i] == "--newline")
- {
- newline = true;
- }
- else
- {
- // Color is enabled. Print with the current color.
- cmSystemTools::MakefileColorEcho(color, args[i].c_str(),
- newline, enabled);
- }
- }
-
- return 0;
-}
-#else
-int cmake::ExecuteEchoColor(std::vector<std::string>&)
-{
- return 1;
-}
-#endif
-
-//----------------------------------------------------------------------------
-int cmake::ExecuteLinkScript(std::vector<std::string>& args)
-{
- // The arguments are
- // argv[0] == <cmake-executable>
- // argv[1] == cmake_link_script
- // argv[2] == <link-script-name>
- // argv[3] == --verbose=?
- bool verbose = false;
- if(args.size() >= 4)
- {
- if(args[3].find("--verbose=") == 0)
- {
- if(!cmSystemTools::IsOff(args[3].substr(10).c_str()))
- {
- verbose = true;
- }
- }
- }
-
- // Allocate a process instance.
- cmsysProcess* cp = cmsysProcess_New();
- if(!cp)
- {
- std::cerr << "Error allocating process instance in link script."
- << std::endl;
- return 1;
- }
-
- // Children should share stdout and stderr with this process.
- cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
- cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
-
- // Run the command lines verbatim.
- cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
-
- // Read command lines from the script.
- std::ifstream fin(args[2].c_str());
- if(!fin)
- {
- std::cerr << "Error opening link script \""
- << args[2] << "\"" << std::endl;
- return 1;
- }
-
- // Run one command at a time.
- std::string command;
- int result = 0;
- while(result == 0 && cmSystemTools::GetLineFromStream(fin, command))
- {
- // Skip empty command lines.
- if(command.find_first_not_of(" \t") == command.npos)
- {
- continue;
- }
-
- // Setup this command line.
- const char* cmd[2] = {command.c_str(), 0};
- cmsysProcess_SetCommand(cp, cmd);
-
- // Report the command if verbose output is enabled.
- if(verbose)
- {
- std::cout << command << std::endl;
- }
-
- // Run the command and wait for it to exit.
- cmsysProcess_Execute(cp);
- cmsysProcess_WaitForExit(cp, 0);
-
- // Report failure if any.
- switch(cmsysProcess_GetState(cp))
- {
- case cmsysProcess_State_Exited:
- {
- int value = cmsysProcess_GetExitValue(cp);
- if(value != 0)
- {
- result = value;
- }
- }
- break;
- case cmsysProcess_State_Exception:
- std::cerr << "Error running link command: "
- << cmsysProcess_GetExceptionString(cp) << std::endl;
- result = 1;
- break;
- case cmsysProcess_State_Error:
- std::cerr << "Error running link command: "
- << cmsysProcess_GetErrorString(cp) << std::endl;
- result = 2;
- break;
- default:
- break;
- };
- }
-
- // Free the process instance.
- cmsysProcess_Delete(cp);
-
- // Return the final resulting return value.
- return result;
-}
-
void cmake::DefineProperties(cmake *cm)
{
cm->DefineProperty
@@ -3640,13 +2635,6 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
chained);
}
-bool cmake::GetIsPropertyDefined(const char *name,
- cmProperty::ScopeType scope)
-{
- return this->PropertyDefinitions[scope].find(name) !=
- this->PropertyDefinitions[scope].end();
-}
-
cmPropertyDefinition *cmake
::GetPropertyDefinition(const char *name,
cmProperty::ScopeType scope)
@@ -4119,356 +3107,6 @@ static bool cmakeCheckStampList(const char* stampList)
}
//----------------------------------------------------------------------------
-int cmake::WindowsCEEnvironment(const char* version, const std::string& name)
-{
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- cmVisualStudioWCEPlatformParser parser(name.c_str());
- parser.ParseVersion(version);
- if (parser.Found())
- {
- std::cout << "@echo off" << std::endl;
- std::cout << "echo Environment Selection: " << name << std::endl;
- std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
- std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() <<std::endl;
- std::cout << "set LIB=" << parser.GetLibraryDirectories() <<std::endl;
- return 0;
- }
-#else
- (void)version;
-#endif
-
- std::cerr << "Could not find " << name;
- return -1;
-}
-
-// For visual studio 2005 and newer manifest files need to be embedded into
-// exe and dll's. This code does that in such a way that incremental linking
-// still works.
-int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
-{
- if(args.size() < 2)
- {
- return -1;
- }
- bool verbose = false;
- if(cmSystemTools::GetEnv("VERBOSE"))
- {
- verbose = true;
- }
- std::vector<std::string> expandedArgs;
- for(std::vector<std::string>::iterator i = args.begin();
- i != args.end(); ++i)
- {
- // check for nmake temporary files
- if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
- {
- std::ifstream fin(i->substr(1).c_str());
- std::string line;
- while(cmSystemTools::GetLineFromStream(fin,
- line))
- {
- cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs);
- }
- }
- else
- {
- expandedArgs.push_back(*i);
- }
- }
- bool hasIncremental = false;
- bool hasManifest = true;
- for(std::vector<std::string>::iterator i = expandedArgs.begin();
- i != expandedArgs.end(); ++i)
- {
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL:YES") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
- {
- hasManifest = false;
- }
- }
- if(hasIncremental && hasManifest)
- {
- if(verbose)
- {
- std::cout << "Visual Studio Incremental Link with embedded manifests\n";
- }
- return cmake::VisualStudioLinkIncremental(expandedArgs, type, verbose);
- }
- if(verbose)
- {
- if(!hasIncremental)
- {
- std::cout << "Visual Studio Non-Incremental Link\n";
- }
- else
- {
- std::cout << "Visual Studio Incremental Link without manifests\n";
- }
- }
- return cmake::VisualStudioLinkNonIncremental(expandedArgs,
- type, hasManifest, verbose);
-}
-
-int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
- std::string& targetName)
-{
- std::vector<std::string>::iterator i = args.begin();
- i++; // skip -E
- i++; // skip vs_link_dll or vs_link_exe
- command.push_back(*i);
- i++; // move past link command
- for(; i != args.end(); ++i)
- {
- command.push_back(*i);
- if(i->find("/Fe") == 0)
- {
- targetName = i->substr(3);
- }
- if(i->find("/out:") == 0)
- {
- targetName = i->substr(5);
- }
- }
- if(targetName.size() == 0 || command.size() == 0)
- {
- return -1;
- }
- return 0;
-}
-
-bool cmake::RunCommand(const char* comment,
- std::vector<cmStdString>& command,
- bool verbose,
- int* retCodeOut)
-{
- if(verbose)
- {
- std::cout << comment << ":\n";
- for(std::vector<cmStdString>::iterator i = command.begin();
- i != command.end(); ++i)
- {
- std::cout << i->c_str() << " ";
- }
- std::cout << "\n";
- }
- std::string output;
- int retCode =0;
- // use rc command to create .res file
- cmSystemTools::RunSingleCommand(command,
- &output,
- &retCode, 0, cmSystemTools::OUTPUT_NONE);
- // always print the output of the command, unless
- // it is the dumb rc command banner, but if the command
- // returned an error code then print the output anyway as
- // the banner may be mixed with some other important information.
- if(output.find("Resource Compiler Version") == output.npos
- || retCode !=0)
- {
- std::cout << output;
- }
- // if retCodeOut is requested then always return true
- // and set the retCodeOut to retCode
- if(retCodeOut)
- {
- *retCodeOut = retCode;
- return true;
- }
- if(retCode != 0)
- {
- std::cout << comment << " failed. with " << retCode << "\n";
- }
- return retCode == 0;
-}
-
-int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type, bool verbose)
-{
- // This follows the steps listed here:
- // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
-
- // 1. Compiler compiles the application and generates the *.obj files.
- // 2. An empty manifest file is generated if this is a clean build and if
- // not the previous one is reused.
- // 3. The resource compiler (rc.exe) compiles the *.manifest file to a
- // *.res file.
- // 4. Linker generates the binary (EXE or DLL) with the /incremental
- // switch and embeds the dummy manifest file. The linker also generates
- // the real manifest file based on the binaries that your binary depends
- // on.
- // 5. The manifest tool (mt.exe) is then used to generate the final
- // manifest.
-
- // If the final manifest is changed, then 6 and 7 are run, if not
- // they are skipped, and it is done.
-
- // 6. The resource compiler is invoked one more time.
- // 7. Finally, the Linker does another incremental link, but since the
- // only thing that has changed is the *.res file that contains the
- // manifest it is a short link.
- std::vector<cmStdString> linkCommand;
- std::string targetName;
- if(cmake::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- std::string manifestArg = "/MANIFESTFILE:";
- std::vector<cmStdString> rcCommand;
- rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
- std::vector<cmStdString> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
- std::string tempManifest;
- tempManifest = targetName;
- tempManifest += ".intermediate.manifest";
- std::string resourceInputFile = targetName;
- resourceInputFile += ".resource.txt";
- if(verbose)
- {
- std::cout << "Create " << resourceInputFile.c_str() << "\n";
- }
- // Create input file for rc command
- std::ofstream fout(resourceInputFile.c_str());
- if(!fout)
- {
- return -1;
- }
- std::string manifestFile = targetName;
- manifestFile += ".embed.manifest";
- std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str());
- fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID "
- "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\"";
- fout.close();
- manifestArg += tempManifest;
- // add the manifest arg to the linkCommand
- linkCommand.push_back("/MANIFEST");
- linkCommand.push_back(manifestArg);
- // if manifestFile is not yet created, create an
- // empty one
- if(!cmSystemTools::FileExists(manifestFile.c_str()))
- {
- if(verbose)
- {
- std::cout << "Create empty: " << manifestFile.c_str() << "\n";
- }
- std::ofstream foutTmp(manifestFile.c_str());
- }
- std::string resourceFile = manifestFile;
- resourceFile += ".res";
- // add the resource file to the end of the link command
- linkCommand.push_back(resourceFile);
- std::string outputOpt = "/fo";
- outputOpt += resourceFile;
- rcCommand.push_back(outputOpt);
- rcCommand.push_back(resourceInputFile);
- // Run rc command to create resource
- if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose))
- {
- return -1;
- }
- // Now run the link command to link and create manifest
- if(!cmake::RunCommand("LINK Pass 1", linkCommand, verbose))
- {
- return -1;
- }
- // create mt command
- std::string outArg("/out:");
- outArg+= manifestFile;
- mtCommand.push_back("/nologo");
- mtCommand.push_back(outArg);
- mtCommand.push_back("/notify_update");
- mtCommand.push_back("/manifest");
- mtCommand.push_back(tempManifest);
- // now run mt.exe to create the final manifest file
- int mtRet =0;
- cmake::RunCommand("MT", mtCommand, verbose, &mtRet);
- // if mt returns 0, then the manifest was not changed and
- // we do not need to do another link step
- if(mtRet == 0)
- {
- return 0;
- }
- // check for magic mt return value if mt returns the magic number
- // 1090650113 then it means that it updated the manifest file and we need
- // to do the final link. If mt has any value other than 0 or 1090650113
- // then there was some problem with the command itself and there was an
- // error so return the error code back out of cmake so make can report it.
- if(mtRet != 1090650113)
- {
- return mtRet;
- }
- // update the resource file with the new manifest from the mt command.
- if(!cmake::RunCommand("RC Pass 2", rcCommand, verbose))
- {
- return -1;
- }
- // Run the final incremental link that will put the new manifest resource
- // into the file incrementally.
- if(!cmake::RunCommand("FINAL LINK", linkCommand, verbose))
- {
- return -1;
- }
- return 0;
-}
-
-int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose)
-{
- std::vector<cmStdString> linkCommand;
- std::string targetName;
- if(cmake::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- // Run the link command as given
- if (hasManifest)
- {
- linkCommand.push_back("/MANIFEST");
- }
- if(!cmake::RunCommand("LINK", linkCommand, verbose))
- {
- return -1;
- }
- if(!hasManifest)
- {
- return 0;
- }
- std::vector<cmStdString> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
- mtCommand.push_back("/nologo");
- mtCommand.push_back("/manifest");
- std::string manifestFile = targetName;
- manifestFile += ".manifest";
- mtCommand.push_back(manifestFile);
- std::string outresource = "/outputresource:";
- outresource += targetName;
- outresource += ";#";
- if(type == 1)
- {
- outresource += "1";
- }
- else if(type == 2)
- {
- outresource += "2";
- }
- mtCommand.push_back(outresource);
- // Now use the mt tool to embed the manifest into the exe or dll
- if(!cmake::RunCommand("MT", mtCommand, verbose))
- {
- return -1;
- }
- return 0;
-}
-
-//----------------------------------------------------------------------------
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace)
{
diff --git a/Source/cmake.h b/Source/cmake.h
index a50c1ed..ccf91e3 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -209,11 +209,6 @@ class cmake
void AddCacheEntry(const char* key, const char* value,
const char* helpString,
int type);
- /**
- * Execute commands during the build process. Supports options such
- * as echo, remove file etc.
- */
- static int ExecuteCMakeCommand(std::vector<std::string>&);
/**
* Get the system information and write it to the file specified
@@ -349,8 +344,6 @@ class cmake
bool chain = false,
const char *variableGroup = 0);
- bool GetIsPropertyDefined(const char *name, cmProperty::ScopeType scope);
-
// get property definition
cmPropertyDefinition *GetPropertyDefinition
(const char *name, cmProperty::ScopeType scope);
@@ -450,29 +443,6 @@ protected:
void GenerateGraphViz(const char* fileName) const;
- static int SymlinkLibrary(std::vector<std::string>& args);
- static int SymlinkExecutable(std::vector<std::string>& args);
- static bool SymlinkInternal(std::string const& file,
- std::string const& link);
- static int ExecuteEchoColor(std::vector<std::string>& args);
- static int ExecuteLinkScript(std::vector<std::string>& args);
- static int WindowsCEEnvironment(const char* version,
- const std::string& name);
- static int VisualStudioLink(std::vector<std::string>& args, int type);
- static int VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type,
- bool verbose);
- static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose);
- static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
- std::string& targetName);
- static bool RunCommand(const char* comment,
- std::vector<cmStdString>& command,
- bool verbose,
- int* retCodeOut = 0);
cmVariableWatch* VariableWatch;
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 68d8339..73c76e4 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -17,6 +17,7 @@
#endif
#include "cmake.h"
+#include "cmcmd.h"
#include "cmCacheManager.h"
#include "cmListFileCache.h"
#include "cmakewizard.h"
@@ -510,7 +511,7 @@ int do_cmake(int ac, char** av)
}
if(command)
{
- int ret = cmake::ExecuteCMakeCommand(args);
+ int ret = cmcmd::ExecuteCMakeCommand(args);
return ret;
}
if (wiz)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
new file mode 100644
index 0000000..48d7d7b
--- /dev/null
+++ b/Source/cmcmd.cxx
@@ -0,0 +1,1374 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmcmd.h"
+#include "cmMakefile.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmQtAutomoc.h"
+#include "cmVersion.h"
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
+# include <cmsys/Terminal.h>
+#endif
+
+#include <cmsys/Directory.hxx>
+#include <cmsys/Process.h>
+
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+#include "cmCallVisualStudioMacro.h"
+#include "cmVisualStudioWCEPlatformParser.h"
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include "cmWin32ProcessExecution.h"
+#endif
+
+#include <time.h>
+
+#include <stdlib.h> // required for atoi
+
+void CMakeCommandUsage(const char* program)
+{
+ cmOStringStream errorStream;
+
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ errorStream
+ << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
+#else
+ errorStream
+ << "cmake bootstrap\n";
+#endif
+ // If you add new commands, change here,
+ // and in cmakemain.cxx in the options table
+ errorStream
+ << "Usage: " << program << " -E [command] [arguments ...]\n"
+ << "Available commands: \n"
+ << " chdir dir cmd [args]... - run command in a given directory\n"
+ << " compare_files file1 file2 - check if file1 is same as file2\n"
+ << " copy file destination - copy file to destination (either file "
+ "or directory)\n"
+ << " copy_directory source destination - copy directory 'source' "
+ "content to directory 'destination'\n"
+ << " copy_if_different in-file out-file - copy file if input has "
+ "changed\n"
+ << " echo [string]... - displays arguments as text\n"
+ << " echo_append [string]... - displays arguments as text but no new "
+ "line\n"
+ << " environment - display the current environment\n"
+ << " make_directory dir - create a directory\n"
+ << " md5sum file1 [...] - compute md5sum of files\n"
+ << " remove [-f] file1 file2 ... - remove the file(s), use -f to force "
+ "it\n"
+ << " remove_directory dir - remove a directory and its contents\n"
+ << " rename oldname newname - rename a file or directory "
+ "(on one volume)\n"
+ << " tar [cxt][vfz][cvfj] file.tar [file/dir1 file/dir2 ...]\n"
+ << " - create or extract a tar or zip archive\n"
+ << " time command [args] ... - run command and return elapsed time\n"
+ << " touch file - touch a file.\n"
+ << " touch_nocreate file - touch a file but do not create it.\n"
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ << "Available on Windows only:\n"
+ << " comspec - on windows 9x use this for RunCommand\n"
+ << " delete_regv key - delete registry value\n"
+ << " env_vs8_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2005\n"
+ << " env_vs9_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2008\n"
+ << " write_regv key value - write registry value\n"
+#else
+ << "Available on UNIX only:\n"
+ << " create_symlink old new - create a symbolic link new -> old\n"
+#endif
+ ;
+
+ cmSystemTools::Error(errorStream.str().c_str());
+}
+
+int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
+{
+ // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx
+ if (args.size() > 1)
+ {
+ // Copy file
+ if (args[1] == "copy" && args.size() == 4)
+ {
+ if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Error copying file \"" << args[2].c_str()
+ << "\" to \"" << args[3].c_str() << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Copy file if different.
+ if (args[1] == "copy_if_different" && args.size() == 4)
+ {
+ if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(),
+ args[3].c_str()))
+ {
+ std::cerr << "Error copying file (if different) from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Copy directory content
+ if (args[1] == "copy_directory" && args.size() == 4)
+ {
+ if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Error copying directory from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Rename a file or directory
+ if (args[1] == "rename" && args.size() == 4)
+ {
+ if(!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str()))
+ {
+ std::string e = cmSystemTools::GetLastSystemError();
+ std::cerr << "Error renaming from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\": " << e << "\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Compare files
+ if (args[1] == "compare_files" && args.size() == 4)
+ {
+ if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Files \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\" are different.\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Echo string
+ else if (args[1] == "echo" )
+ {
+ unsigned int cc;
+ const char* space = "";
+ for ( cc = 2; cc < args.size(); cc ++ )
+ {
+ std::cout << space << args[cc];
+ space = " ";
+ }
+ std::cout << std::endl;
+ return 0;
+ }
+
+ // Echo string no new line
+ else if (args[1] == "echo_append" )
+ {
+ unsigned int cc;
+ const char* space = "";
+ for ( cc = 2; cc < args.size(); cc ++ )
+ {
+ std::cout << space << args[cc];
+ space = " ";
+ }
+ return 0;
+ }
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ // Command to create a symbolic link. Fails on platforms not
+ // supporting them.
+ else if (args[1] == "environment" )
+ {
+ std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
+ std::vector<std::string>::iterator it;
+ for ( it = env.begin(); it != env.end(); ++ it )
+ {
+ std::cout << it->c_str() << std::endl;
+ }
+ return 0;
+ }
+#endif
+
+ else if (args[1] == "make_directory" && args.size() == 3)
+ {
+ if(!cmSystemTools::MakeDirectory(args[2].c_str()))
+ {
+ std::cerr << "Error making directory \"" << args[2].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ else if (args[1] == "remove_directory" && args.size() == 3)
+ {
+ if(cmSystemTools::FileIsDirectory(args[2].c_str()) &&
+ !cmSystemTools::RemoveADirectory(args[2].c_str()))
+ {
+ std::cerr << "Error removing directory \"" << args[2].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Remove file
+ else if (args[1] == "remove" && args.size() > 2)
+ {
+ bool force = false;
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ if(args[cc] == "\\-f" || args[cc] == "-f")
+ {
+ force = true;
+ }
+ else
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force &&
+ cmSystemTools::FileExists(args[cc].c_str()))
+ {
+ return 1;
+ }
+ }
+ }
+ return 0;
+ }
+ // Touch file
+ else if (args[1] == "touch" && args.size() > 2)
+ {
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::Touch(args[cc].c_str(), true))
+ {
+ return 1;
+ }
+ }
+ return 0;
+ }
+ // Touch file
+ else if (args[1] == "touch_nocreate" && args.size() > 2)
+ {
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::Touch(args[cc].c_str(), false))
+ {
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ // Clock command
+ else if (args[1] == "time" && args.size() > 2)
+ {
+ std::string command = args[2];
+ for (std::string::size_type cc = 3; cc < args.size(); cc ++)
+ {
+ command += " ";
+ command += args[cc];
+ }
+
+ clock_t clock_start, clock_finish;
+ time_t time_start, time_finish;
+
+ time(&time_start);
+ clock_start = clock();
+ int ret =0;
+ cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret);
+
+ clock_finish = clock();
+ time(&time_finish);
+
+ double clocks_per_sec = static_cast<double>(CLOCKS_PER_SEC);
+ std::cout << "Elapsed time: "
+ << static_cast<long>(time_finish - time_start) << " s. (time)"
+ << ", "
+ << static_cast<double>(clock_finish - clock_start) / clocks_per_sec
+ << " s. (clock)"
+ << "\n";
+ return ret;
+ }
+ // Command to calculate the md5sum of a file
+ else if (args[1] == "md5sum" && args.size() >= 3)
+ {
+ char md5out[32];
+ int retval = 0;
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ const char *filename = args[cc].c_str();
+ // Cannot compute md5sum of a directory
+ if(cmSystemTools::FileIsDirectory(filename))
+ {
+ std::cerr << "Error: " << filename << " is a directory" << std::endl;
+ retval++;
+ }
+ else if(!cmSystemTools::ComputeFileMD5(filename, md5out))
+ {
+ // To mimic md5sum behavior in a shell:
+ std::cerr << filename << ": No such file or directory" << std::endl;
+ retval++;
+ }
+ else
+ {
+ std::cout << std::string(md5out,32) << " " << filename << std::endl;
+ }
+ }
+ return retval;
+ }
+
+ // Command to change directory and run a program.
+ else if (args[1] == "chdir" && args.size() >= 4)
+ {
+ std::string directory = args[2];
+ if(!cmSystemTools::FileExists(directory.c_str()))
+ {
+ cmSystemTools::Error("Directory does not exist for chdir command: ",
+ args[2].c_str());
+ return 1;
+ }
+
+ std::string command = "\"";
+ command += args[3];
+ command += "\"";
+ for (std::string::size_type cc = 4; cc < args.size(); cc ++)
+ {
+ command += " \"";
+ command += args[cc];
+ command += "\"";
+ }
+ int retval = 0;
+ int timeout = 0;
+ if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
+ directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) )
+ {
+ return retval;
+ }
+
+ return 1;
+ }
+
+ // Command to start progress for a build
+ else if (args[1] == "cmake_progress_start" && args.size() == 4)
+ {
+ // basically remove the directory
+ std::string dirName = args[2];
+ dirName += "/Progress";
+ cmSystemTools::RemoveADirectory(dirName.c_str());
+
+ // is the last argument a filename that exists?
+ FILE *countFile = fopen(args[3].c_str(),"r");
+ int count;
+ if (countFile)
+ {
+ if (1!=fscanf(countFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from count file.");
+ }
+ fclose(countFile);
+ }
+ else
+ {
+ count = atoi(args[3].c_str());
+ }
+ if (count)
+ {
+ cmSystemTools::MakeDirectory(dirName.c_str());
+ // write the count into the directory
+ std::string fName = dirName;
+ fName += "/count.txt";
+ FILE *progFile = fopen(fName.c_str(),"w");
+ if (progFile)
+ {
+ fprintf(progFile,"%i\n",count);
+ fclose(progFile);
+ }
+ }
+ return 0;
+ }
+
+ // Command to report progress for a build
+ else if (args[1] == "cmake_progress_report" && args.size() >= 3)
+ {
+ std::string dirName = args[2];
+ dirName += "/Progress";
+ std::string fName;
+ FILE *progFile;
+
+ // read the count
+ fName = dirName;
+ fName += "/count.txt";
+ progFile = fopen(fName.c_str(),"r");
+ int count = 0;
+ if (!progFile)
+ {
+ return 0;
+ }
+ else
+ {
+ if (1!=fscanf(progFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from progress file.");
+ }
+ fclose(progFile);
+ }
+ unsigned int i;
+ for (i = 3; i < args.size(); ++i)
+ {
+ fName = dirName;
+ fName += "/";
+ fName += args[i];
+ progFile = fopen(fName.c_str(),"w");
+ if (progFile)
+ {
+ fprintf(progFile,"empty");
+ fclose(progFile);
+ }
+ }
+ int fileNum = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
+ if (count > 0)
+ {
+ // print the progress
+ fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
+ }
+ return 0;
+ }
+
+ // Command to create a symbolic link. Fails on platforms not
+ // supporting them.
+ else if (args[1] == "create_symlink" && args.size() == 4)
+ {
+ const char* destinationFileName = args[3].c_str();
+ if ( cmSystemTools::FileExists(destinationFileName) )
+ {
+ if ( cmSystemTools::FileIsSymlink(destinationFileName) )
+ {
+ if ( !cmSystemTools::RemoveFile(destinationFileName) ||
+ cmSystemTools::FileExists(destinationFileName) )
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ return cmSystemTools::CreateSymlink(args[2].c_str(),
+ args[3].c_str())? 0:1;
+ }
+
+ // Internal CMake shared library support.
+ else if (args[1] == "cmake_symlink_library" && args.size() == 5)
+ {
+ return cmcmd::SymlinkLibrary(args);
+ }
+ // Internal CMake versioned executable support.
+ else if (args[1] == "cmake_symlink_executable" && args.size() == 4)
+ {
+ return cmcmd::SymlinkExecutable(args);
+ }
+
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ // Internal CMake support for calling Visual Studio macros.
+ else if (args[1] == "cmake_call_visual_studio_macro" && args.size() >= 4)
+ {
+ // args[2] = full path to .sln file or "ALL"
+ // args[3] = name of Visual Studio macro to call
+ // args[4..args.size()-1] = [optional] args for Visual Studio macro
+
+ std::string macroArgs;
+
+ if (args.size() > 4)
+ {
+ macroArgs = args[4];
+
+ for (size_t i = 5; i < args.size(); ++i)
+ {
+ macroArgs += " ";
+ macroArgs += args[i];
+ }
+ }
+
+ return cmCallVisualStudioMacro::CallMacro(args[2], args[3],
+ macroArgs, true);
+ }
+#endif
+
+ // Internal CMake dependency scanning support.
+ else if (args[1] == "cmake_depends" && args.size() >= 6)
+ {
+ // Use the make system's VERBOSE environment variable to enable
+ // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
+ // (which is set by the Eclipse and KDevelop generators).
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+
+ // Create a cmake object instance to process dependencies.
+ cmake cm;
+ std::string gen;
+ std::string homeDir;
+ std::string startDir;
+ std::string homeOutDir;
+ std::string startOutDir;
+ std::string depInfo;
+ bool color = false;
+ if(args.size() >= 8)
+ {
+ // Full signature:
+ //
+ // -E cmake_depends <generator>
+ // <home-src-dir> <start-src-dir>
+ // <home-out-dir> <start-out-dir>
+ // <dep-info> [--color=$(COLOR)]
+ //
+ // All paths are provided.
+ gen = args[2];
+ homeDir = args[3];
+ startDir = args[4];
+ homeOutDir = args[5];
+ startOutDir = args[6];
+ depInfo = args[7];
+ if(args.size() >= 9 &&
+ args[8].length() >= 8 &&
+ args[8].substr(0, 8) == "--color=")
+ {
+ // Enable or disable color based on the switch value.
+ color = (args[8].size() == 8 ||
+ cmSystemTools::IsOn(args[8].substr(8).c_str()));
+ }
+ }
+ else
+ {
+ // Support older signature for existing makefiles:
+ //
+ // -E cmake_depends <generator>
+ // <home-out-dir> <start-out-dir>
+ // <dep-info>
+ //
+ // Just pretend the source directories are the same as the
+ // binary directories so at least scanning will work.
+ gen = args[2];
+ homeDir = args[3];
+ startDir = args[4];
+ homeOutDir = args[3];
+ startOutDir = args[3];
+ depInfo = args[5];
+ }
+
+ // Create a local generator configured for the directory in
+ // which dependencies will be scanned.
+ homeDir = cmSystemTools::CollapseFullPath(homeDir.c_str());
+ startDir = cmSystemTools::CollapseFullPath(startDir.c_str());
+ homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str());
+ startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str());
+ cm.SetHomeDirectory(homeDir.c_str());
+ cm.SetStartDirectory(startDir.c_str());
+ cm.SetHomeOutputDirectory(homeOutDir.c_str());
+ cm.SetStartOutputDirectory(startOutDir.c_str());
+ if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str()))
+ {
+ cm.SetGlobalGenerator(ggd);
+ cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
+ lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
+ lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
+ lgd->GetMakefile()->MakeStartDirectoriesCurrent();
+
+ // Actually scan dependencies.
+ return lgd->UpdateDependencies(depInfo.c_str(),
+ verbose, color)? 0 : 2;
+ }
+ return 1;
+ }
+
+ // Internal CMake link script support.
+ else if (args[1] == "cmake_link_script" && args.size() >= 3)
+ {
+ return cmcmd::ExecuteLinkScript(args);
+ }
+
+ // Internal CMake unimplemented feature notification.
+ else if (args[1] == "cmake_unimplemented_variable")
+ {
+ std::cerr << "Feature not implemented for this platform.";
+ if(args.size() == 3)
+ {
+ std::cerr << " Variable " << args[2] << " is not set.";
+ }
+ std::cerr << std::endl;
+ return 1;
+ }
+ else if (args[1] == "vs_link_exe")
+ {
+ return cmcmd::VisualStudioLink(args, 1);
+ }
+ else if (args[1] == "vs_link_dll")
+ {
+ return cmcmd::VisualStudioLink(args, 2);
+ }
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ // Internal CMake color makefile support.
+ else if (args[1] == "cmake_echo_color")
+ {
+ return cmcmd::ExecuteEchoColor(args);
+ }
+ else if (args[1] == "cmake_automoc")
+ {
+ cmQtAutomoc automoc;
+ const char *config = args[3].empty() ? 0 : args[3].c_str();
+ bool automocSuccess = automoc.Run(args[2].c_str(), config);
+ return automocSuccess ? 0 : 1;
+ }
+#endif
+
+ // Tar files
+ else if (args[1] == "tar" && args.size() > 3)
+ {
+ std::string flags = args[2];
+ std::string outFile = args[3];
+ std::vector<cmStdString> files;
+ for (std::string::size_type cc = 4; cc < args.size(); cc ++)
+ {
+ files.push_back(args[cc]);
+ }
+ bool gzip = false;
+ bool bzip2 = false;
+ bool verbose = false;
+ if ( flags.find_first_of('j') != flags.npos )
+ {
+ bzip2 = true;
+ }
+ if ( flags.find_first_of('z') != flags.npos )
+ {
+ gzip = true;
+ }
+ if ( flags.find_first_of('v') != flags.npos )
+ {
+ verbose = true;
+ }
+
+ if ( flags.find_first_of('t') != flags.npos )
+ {
+ if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
+ }
+ else if ( flags.find_first_of('c') != flags.npos )
+ {
+ if ( !cmSystemTools::CreateTar(
+ outFile.c_str(), files, gzip, bzip2, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
+ }
+ else if ( flags.find_first_of('x') != flags.npos )
+ {
+ if ( !cmSystemTools::ExtractTar(
+ outFile.c_str(), gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
+ return 1;
+ }
+#ifdef WIN32
+ // OK, on windows 7 after we untar some files,
+ // sometimes we can not rename the directory after
+ // the untar is done. This breaks the external project
+ // untar and rename code. So, by default we will wait
+ // 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
+ // is set in the env, its value will be used instead of 100.
+ int delay = 100;
+ const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
+ if(delayVar)
+ {
+ delay = atoi(delayVar);
+ }
+ if(delay)
+ {
+ cmSystemTools::Delay(delay);
+ }
+#endif
+ }
+ return 0;
+ }
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ // Internal CMake Fortran module support.
+ else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4)
+ {
+ return cmDependsFortran::CopyModule(args)? 0 : 1;
+ }
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // Write registry value
+ else if (args[1] == "write_regv" && args.size() > 3)
+ {
+ return cmSystemTools::WriteRegistryValue(args[2].c_str(),
+ args[3].c_str()) ? 0 : 1;
+ }
+
+ // Delete registry value
+ else if (args[1] == "delete_regv" && args.size() > 2)
+ {
+ return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
+ }
+ // Remove file
+ else if (args[1] == "comspec" && args.size() > 2)
+ {
+ unsigned int cc;
+ std::string command = args[2];
+ for ( cc = 3; cc < args.size(); cc ++ )
+ {
+ command += " " + args[cc];
+ }
+ return cmWin32ProcessExecution::Windows9xHack(command.c_str());
+ }
+ else if (args[1] == "env_vs8_wince" && args.size() == 3)
+ {
+ return cmcmd::WindowsCEEnvironment("8.0", args[2]);
+ }
+ else if (args[1] == "env_vs9_wince" && args.size() == 3)
+ {
+ return cmcmd::WindowsCEEnvironment("9.0", args[2]);
+ }
+#endif
+ }
+
+ ::CMakeCommandUsage(args[0].c_str());
+ return 1;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::SymlinkLibrary(std::vector<std::string>& args)
+{
+ int result = 0;
+ std::string realName = args[2];
+ std::string soName = args[3];
+ std::string name = args[4];
+ if(soName != realName)
+ {
+ if(!cmcmd::SymlinkInternal(realName, soName))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ result = 1;
+ }
+ }
+ if(name != soName)
+ {
+ if(!cmcmd::SymlinkInternal(soName, name))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ result = 1;
+ }
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::SymlinkExecutable(std::vector<std::string>& args)
+{
+ int result = 0;
+ std::string realName = args[2];
+ std::string name = args[3];
+ if(name != realName)
+ {
+ if(!cmcmd::SymlinkInternal(realName, name))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
+ result = 1;
+ }
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
+{
+ if(cmSystemTools::FileExists(link.c_str()) ||
+ cmSystemTools::FileIsSymlink(link.c_str()))
+ {
+ cmSystemTools::RemoveFile(link.c_str());
+ }
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
+#else
+ std::string linktext = cmSystemTools::GetFilenameName(file);
+ return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
+#endif
+}
+
+//----------------------------------------------------------------------------
+#ifdef CMAKE_BUILD_WITH_CMAKE
+int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
+{
+ // The arguments are
+ // argv[0] == <cmake-executable>
+ // argv[1] == cmake_echo_color
+
+ bool enabled = true;
+ int color = cmsysTerminal_Color_Normal;
+ bool newline = true;
+ for(unsigned int i=2; i < args.size(); ++i)
+ {
+ if(args[i].find("--switch=") == 0)
+ {
+ // Enable or disable color based on the switch value.
+ std::string value = args[i].substr(9);
+ if(!value.empty())
+ {
+ if(cmSystemTools::IsOn(value.c_str()))
+ {
+ enabled = true;
+ }
+ else
+ {
+ enabled = false;
+ }
+ }
+ }
+ else if(args[i] == "--normal")
+ {
+ color = cmsysTerminal_Color_Normal;
+ }
+ else if(args[i] == "--black")
+ {
+ color = cmsysTerminal_Color_ForegroundBlack;
+ }
+ else if(args[i] == "--red")
+ {
+ color = cmsysTerminal_Color_ForegroundRed;
+ }
+ else if(args[i] == "--green")
+ {
+ color = cmsysTerminal_Color_ForegroundGreen;
+ }
+ else if(args[i] == "--yellow")
+ {
+ color = cmsysTerminal_Color_ForegroundYellow;
+ }
+ else if(args[i] == "--blue")
+ {
+ color = cmsysTerminal_Color_ForegroundBlue;
+ }
+ else if(args[i] == "--magenta")
+ {
+ color = cmsysTerminal_Color_ForegroundMagenta;
+ }
+ else if(args[i] == "--cyan")
+ {
+ color = cmsysTerminal_Color_ForegroundCyan;
+ }
+ else if(args[i] == "--white")
+ {
+ color = cmsysTerminal_Color_ForegroundWhite;
+ }
+ else if(args[i] == "--bold")
+ {
+ color |= cmsysTerminal_Color_ForegroundBold;
+ }
+ else if(args[i] == "--no-newline")
+ {
+ newline = false;
+ }
+ else if(args[i] == "--newline")
+ {
+ newline = true;
+ }
+ else
+ {
+ // Color is enabled. Print with the current color.
+ cmSystemTools::MakefileColorEcho(color, args[i].c_str(),
+ newline, enabled);
+ }
+ }
+
+ return 0;
+}
+#else
+int cmcmd::ExecuteEchoColor(std::vector<std::string>&)
+{
+ return 1;
+}
+#endif
+
+//----------------------------------------------------------------------------
+int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
+{
+ // The arguments are
+ // argv[0] == <cmake-executable>
+ // argv[1] == cmake_link_script
+ // argv[2] == <link-script-name>
+ // argv[3] == --verbose=?
+ bool verbose = false;
+ if(args.size() >= 4)
+ {
+ if(args[3].find("--verbose=") == 0)
+ {
+ if(!cmSystemTools::IsOff(args[3].substr(10).c_str()))
+ {
+ verbose = true;
+ }
+ }
+ }
+
+ // Allocate a process instance.
+ cmsysProcess* cp = cmsysProcess_New();
+ if(!cp)
+ {
+ std::cerr << "Error allocating process instance in link script."
+ << std::endl;
+ return 1;
+ }
+
+ // Children should share stdout and stderr with this process.
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
+
+ // Run the command lines verbatim.
+ cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
+
+ // Read command lines from the script.
+ std::ifstream fin(args[2].c_str());
+ if(!fin)
+ {
+ std::cerr << "Error opening link script \""
+ << args[2] << "\"" << std::endl;
+ return 1;
+ }
+
+ // Run one command at a time.
+ std::string command;
+ int result = 0;
+ while(result == 0 && cmSystemTools::GetLineFromStream(fin, command))
+ {
+ // Skip empty command lines.
+ if(command.find_first_not_of(" \t") == command.npos)
+ {
+ continue;
+ }
+
+ // Setup this command line.
+ const char* cmd[2] = {command.c_str(), 0};
+ cmsysProcess_SetCommand(cp, cmd);
+
+ // Report the command if verbose output is enabled.
+ if(verbose)
+ {
+ std::cout << command << std::endl;
+ }
+
+ // Run the command and wait for it to exit.
+ cmsysProcess_Execute(cp);
+ cmsysProcess_WaitForExit(cp, 0);
+
+ // Report failure if any.
+ switch(cmsysProcess_GetState(cp))
+ {
+ case cmsysProcess_State_Exited:
+ {
+ int value = cmsysProcess_GetExitValue(cp);
+ if(value != 0)
+ {
+ result = value;
+ }
+ }
+ break;
+ case cmsysProcess_State_Exception:
+ std::cerr << "Error running link command: "
+ << cmsysProcess_GetExceptionString(cp) << std::endl;
+ result = 1;
+ break;
+ case cmsysProcess_State_Error:
+ std::cerr << "Error running link command: "
+ << cmsysProcess_GetErrorString(cp) << std::endl;
+ result = 2;
+ break;
+ default:
+ break;
+ };
+ }
+
+ // Free the process instance.
+ cmsysProcess_Delete(cp);
+
+ // Return the final resulting return value.
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
+{
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ cmVisualStudioWCEPlatformParser parser(name.c_str());
+ parser.ParseVersion(version);
+ if (parser.Found())
+ {
+ std::cout << "@echo off" << std::endl;
+ std::cout << "echo Environment Selection: " << name << std::endl;
+ std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
+ std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() <<std::endl;
+ std::cout << "set LIB=" << parser.GetLibraryDirectories() <<std::endl;
+ return 0;
+ }
+#else
+ (void)version;
+#endif
+
+ std::cerr << "Could not find " << name;
+ return -1;
+}
+
+// For visual studio 2005 and newer manifest files need to be embedded into
+// exe and dll's. This code does that in such a way that incremental linking
+// still works.
+int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
+{
+ if(args.size() < 2)
+ {
+ return -1;
+ }
+ bool verbose = false;
+ if(cmSystemTools::GetEnv("VERBOSE"))
+ {
+ verbose = true;
+ }
+ std::vector<std::string> expandedArgs;
+ for(std::vector<std::string>::iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ // check for nmake temporary files
+ if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
+ {
+ std::ifstream fin(i->substr(1).c_str());
+ std::string line;
+ while(cmSystemTools::GetLineFromStream(fin,
+ line))
+ {
+ cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs);
+ }
+ }
+ else
+ {
+ expandedArgs.push_back(*i);
+ }
+ }
+ bool hasIncremental = false;
+ bool hasManifest = true;
+ for(std::vector<std::string>::iterator i = expandedArgs.begin();
+ i != expandedArgs.end(); ++i)
+ {
+ if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL:YES") == 0)
+ {
+ hasIncremental = true;
+ }
+ if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
+ {
+ hasIncremental = true;
+ }
+ if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
+ {
+ hasManifest = false;
+ }
+ }
+ if(hasIncremental && hasManifest)
+ {
+ if(verbose)
+ {
+ std::cout << "Visual Studio Incremental Link with embedded manifests\n";
+ }
+ return cmcmd::VisualStudioLinkIncremental(expandedArgs, type, verbose);
+ }
+ if(verbose)
+ {
+ if(!hasIncremental)
+ {
+ std::cout << "Visual Studio Non-Incremental Link\n";
+ }
+ else
+ {
+ std::cout << "Visual Studio Incremental Link without manifests\n";
+ }
+ }
+ return cmcmd::VisualStudioLinkNonIncremental(expandedArgs,
+ type, hasManifest, verbose);
+}
+
+int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
+ std::string& targetName)
+{
+ std::vector<std::string>::iterator i = args.begin();
+ i++; // skip -E
+ i++; // skip vs_link_dll or vs_link_exe
+ command.push_back(*i);
+ i++; // move past link command
+ for(; i != args.end(); ++i)
+ {
+ command.push_back(*i);
+ if(i->find("/Fe") == 0)
+ {
+ targetName = i->substr(3);
+ }
+ if(i->find("/out:") == 0)
+ {
+ targetName = i->substr(5);
+ }
+ }
+ if(targetName.size() == 0 || command.size() == 0)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+bool cmcmd::RunCommand(const char* comment,
+ std::vector<cmStdString>& command,
+ bool verbose,
+ int* retCodeOut)
+{
+ if(verbose)
+ {
+ std::cout << comment << ":\n";
+ for(std::vector<cmStdString>::iterator i = command.begin();
+ i != command.end(); ++i)
+ {
+ std::cout << i->c_str() << " ";
+ }
+ std::cout << "\n";
+ }
+ std::string output;
+ int retCode =0;
+ // use rc command to create .res file
+ cmSystemTools::RunSingleCommand(command,
+ &output,
+ &retCode, 0, cmSystemTools::OUTPUT_NONE);
+ // always print the output of the command, unless
+ // it is the dumb rc command banner, but if the command
+ // returned an error code then print the output anyway as
+ // the banner may be mixed with some other important information.
+ if(output.find("Resource Compiler Version") == output.npos
+ || retCode !=0)
+ {
+ std::cout << output;
+ }
+ // if retCodeOut is requested then always return true
+ // and set the retCodeOut to retCode
+ if(retCodeOut)
+ {
+ *retCodeOut = retCode;
+ return true;
+ }
+ if(retCode != 0)
+ {
+ std::cout << comment << " failed. with " << retCode << "\n";
+ }
+ return retCode == 0;
+}
+
+int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
+ int type, bool verbose)
+{
+ // This follows the steps listed here:
+ // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
+
+ // 1. Compiler compiles the application and generates the *.obj files.
+ // 2. An empty manifest file is generated if this is a clean build and if
+ // not the previous one is reused.
+ // 3. The resource compiler (rc.exe) compiles the *.manifest file to a
+ // *.res file.
+ // 4. Linker generates the binary (EXE or DLL) with the /incremental
+ // switch and embeds the dummy manifest file. The linker also generates
+ // the real manifest file based on the binaries that your binary depends
+ // on.
+ // 5. The manifest tool (mt.exe) is then used to generate the final
+ // manifest.
+
+ // If the final manifest is changed, then 6 and 7 are run, if not
+ // they are skipped, and it is done.
+
+ // 6. The resource compiler is invoked one more time.
+ // 7. Finally, the Linker does another incremental link, but since the
+ // only thing that has changed is the *.res file that contains the
+ // manifest it is a short link.
+ std::vector<cmStdString> linkCommand;
+ std::string targetName;
+ if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
+ {
+ return -1;
+ }
+ std::string manifestArg = "/MANIFESTFILE:";
+ std::vector<cmStdString> rcCommand;
+ rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
+ std::vector<cmStdString> mtCommand;
+ mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
+ std::string tempManifest;
+ tempManifest = targetName;
+ tempManifest += ".intermediate.manifest";
+ std::string resourceInputFile = targetName;
+ resourceInputFile += ".resource.txt";
+ if(verbose)
+ {
+ std::cout << "Create " << resourceInputFile.c_str() << "\n";
+ }
+ // Create input file for rc command
+ std::ofstream fout(resourceInputFile.c_str());
+ if(!fout)
+ {
+ return -1;
+ }
+ std::string manifestFile = targetName;
+ manifestFile += ".embed.manifest";
+ std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str());
+ fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID "
+ "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\"";
+ fout.close();
+ manifestArg += tempManifest;
+ // add the manifest arg to the linkCommand
+ linkCommand.push_back("/MANIFEST");
+ linkCommand.push_back(manifestArg);
+ // if manifestFile is not yet created, create an
+ // empty one
+ if(!cmSystemTools::FileExists(manifestFile.c_str()))
+ {
+ if(verbose)
+ {
+ std::cout << "Create empty: " << manifestFile.c_str() << "\n";
+ }
+ std::ofstream foutTmp(manifestFile.c_str());
+ }
+ std::string resourceFile = manifestFile;
+ resourceFile += ".res";
+ // add the resource file to the end of the link command
+ linkCommand.push_back(resourceFile);
+ std::string outputOpt = "/fo";
+ outputOpt += resourceFile;
+ rcCommand.push_back(outputOpt);
+ rcCommand.push_back(resourceInputFile);
+ // Run rc command to create resource
+ if(!cmcmd::RunCommand("RC Pass 1", rcCommand, verbose))
+ {
+ return -1;
+ }
+ // Now run the link command to link and create manifest
+ if(!cmcmd::RunCommand("LINK Pass 1", linkCommand, verbose))
+ {
+ return -1;
+ }
+ // create mt command
+ std::string outArg("/out:");
+ outArg+= manifestFile;
+ mtCommand.push_back("/nologo");
+ mtCommand.push_back(outArg);
+ mtCommand.push_back("/notify_update");
+ mtCommand.push_back("/manifest");
+ mtCommand.push_back(tempManifest);
+ // now run mt.exe to create the final manifest file
+ int mtRet =0;
+ cmcmd::RunCommand("MT", mtCommand, verbose, &mtRet);
+ // if mt returns 0, then the manifest was not changed and
+ // we do not need to do another link step
+ if(mtRet == 0)
+ {
+ return 0;
+ }
+ // check for magic mt return value if mt returns the magic number
+ // 1090650113 then it means that it updated the manifest file and we need
+ // to do the final link. If mt has any value other than 0 or 1090650113
+ // then there was some problem with the command itself and there was an
+ // error so return the error code back out of cmake so make can report it.
+ if(mtRet != 1090650113)
+ {
+ return mtRet;
+ }
+ // update the resource file with the new manifest from the mt command.
+ if(!cmcmd::RunCommand("RC Pass 2", rcCommand, verbose))
+ {
+ return -1;
+ }
+ // Run the final incremental link that will put the new manifest resource
+ // into the file incrementally.
+ if(!cmcmd::RunCommand("FINAL LINK", linkCommand, verbose))
+ {
+ return -1;
+ }
+ return 0;
+}
+
+int cmcmd::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
+ int type,
+ bool hasManifest,
+ bool verbose)
+{
+ std::vector<cmStdString> linkCommand;
+ std::string targetName;
+ if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
+ {
+ return -1;
+ }
+ // Run the link command as given
+ if (hasManifest)
+ {
+ linkCommand.push_back("/MANIFEST");
+ }
+ if(!cmcmd::RunCommand("LINK", linkCommand, verbose))
+ {
+ return -1;
+ }
+ if(!hasManifest)
+ {
+ return 0;
+ }
+ std::vector<cmStdString> mtCommand;
+ mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
+ mtCommand.push_back("/nologo");
+ mtCommand.push_back("/manifest");
+ std::string manifestFile = targetName;
+ manifestFile += ".manifest";
+ mtCommand.push_back(manifestFile);
+ std::string outresource = "/outputresource:";
+ outresource += targetName;
+ outresource += ";#";
+ if(type == 1)
+ {
+ outresource += "1";
+ }
+ else if(type == 2)
+ {
+ outresource += "2";
+ }
+ mtCommand.push_back(outresource);
+ // Now use the mt tool to embed the manifest into the exe or dll
+ if(!cmcmd::RunCommand("MT", mtCommand, verbose))
+ {
+ return -1;
+ }
+ return 0;
+}
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
new file mode 100644
index 0000000..4517ebf
--- /dev/null
+++ b/Source/cmcmd.h
@@ -0,0 +1,54 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmcmd_h
+#define cmcmd_h
+
+#include "cmStandardIncludes.h"
+
+class cmcmd
+{
+public:
+
+ /**
+ * Execute commands during the build process. Supports options such
+ * as echo, remove file etc.
+ */
+ static int ExecuteCMakeCommand(std::vector<std::string>&);
+protected:
+
+ static int SymlinkLibrary(std::vector<std::string>& args);
+ static int SymlinkExecutable(std::vector<std::string>& args);
+ static bool SymlinkInternal(std::string const& file,
+ std::string const& link);
+ static int ExecuteEchoColor(std::vector<std::string>& args);
+ static int ExecuteLinkScript(std::vector<std::string>& args);
+ static int WindowsCEEnvironment(const char* version,
+ const std::string& name);
+ static int VisualStudioLink(std::vector<std::string>& args, int type);
+ static int VisualStudioLinkIncremental(std::vector<std::string>& args,
+ int type,
+ bool verbose);
+ static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
+ int type,
+ bool hasManifest,
+ bool verbose);
+ static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
+ std::string& targetName);
+ static bool RunCommand(const char* comment,
+ std::vector<cmStdString>& command,
+ bool verbose,
+ int* retCodeOut = 0);
+};
+
+#endif
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index e767a16..ece68f5 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -150,6 +150,13 @@ static const char * cmDocumentationOptions[][3] =
{"-U, --union", "Take the Union of -I and -R",
"When both -R and -I are specified by default the intersection of "
"tests are run. By specifying -U the union of tests is run instead."},
+ {"--rerun-failed", "Run only the tests that failed previously",
+ "This option tells ctest to perform only the tests that failed during its "
+ "previous run. When this option is specified, ctest ignores all other "
+ "options intended to modify the list of tests to run "
+ "(-L, -R, -E, -LE, -I, etc). In the event that CTest runs and no tests "
+ "fail, subsequent calls to ctest with the --rerun-failed option will "
+ "run the set of tests that most recently failed (if any)."},
{"--max-width <width>", "Set the max width for a test name to output",
"Set the maximum width for each test name to show in the output. This "
"allows the user to widen the output to avoid clipping the test name which "