summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-02-22 21:21:48 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-02-22 21:21:48 (GMT)
commitbada88e8e45640afa5ef063aeab180fd6f1cfee4 (patch)
tree65e489a11a6014b756ab8d8b86df584ac3eb2bcc /Source
parent54bd175eea66704a879fc72278cdbb49efdd801c (diff)
parent8233636dbe531ccf36510242e7c997dfa6529bde (diff)
downloadCMake-bada88e8e45640afa5ef063aeab180fd6f1cfee4.zip
CMake-bada88e8e45640afa5ef063aeab180fd6f1cfee4.tar.gz
CMake-bada88e8e45640afa5ef063aeab180fd6f1cfee4.tar.bz2
Merge branch 'target-include-directories' into ninja-generator
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackDocumentMacros.cxx16
-rw-r--r--Source/CPack/cmCPackDocumentMacros.h21
-rw-r--r--Source/CPack/cmCPackDocumentVariables.cxx32
-rw-r--r--Source/CPack/cmCPackDocumentVariables.h21
-rw-r--r--Source/CPack/cmCPackGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx94
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CursesDialog/ccmake.cxx1
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx11
-rw-r--r--Source/QtDialog/CMakeLists.txt4
-rw-r--r--Source/QtDialog/CMakeSetup.cxx1
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx3
-rw-r--r--Source/QtDialog/QCMake.cxx13
-rw-r--r--Source/QtDialog/QCMake.h5
-rw-r--r--Source/cmBootstrapCommands.cxx8
-rw-r--r--Source/cmCommand.h11
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx14
-rw-r--r--Source/cmComputeLinkInformation.h1
-rw-r--r--Source/cmCoreTryCompile.cxx13
-rw-r--r--Source/cmDepends.cxx14
-rw-r--r--Source/cmDocumentation.cxx471
-rw-r--r--Source/cmDocumentation.h70
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx11
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx10
-rw-r--r--Source/cmFindLibraryCommand.cxx18
-rw-r--r--Source/cmFindPackageCommand.cxx9
-rw-r--r--Source/cmFunctionCommand.cxx11
-rw-r--r--Source/cmGlobalGenerator.cxx39
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmIncludeDirectoryCommand.h22
-rw-r--r--Source/cmLocalGenerator.cxx52
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx37
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx105
-rw-r--r--Source/cmLocalVisualStudio6Generator.h2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMacroCommand.cxx11
-rw-r--r--Source/cmMakeDepend.cxx35
-rw-r--r--Source/cmMakefile.cxx154
-rw-r--r--Source/cmMakefile.h20
-rw-r--r--Source/cmMakefileTargetGenerator.cxx39
-rw-r--r--Source/cmSystemTools.cxx16
-rw-r--r--Source/cmSystemTools.h9
-rw-r--r--Source/cmTarget.cxx67
-rw-r--r--Source/cmTarget.h3
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx58
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Source/cmWhileCommand.cxx18
-rw-r--r--Source/cmake.cxx61
-rw-r--r--Source/cmake.h2
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake2
57 files changed, 1279 insertions, 399 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 3ae9464..eb4327c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -466,6 +466,8 @@ SET(CPACK_SRCS
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPackDocumentVariables.cxx
+ CPack/cmCPackDocumentMacros.cxx
)
IF(CYGWIN)
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 0ce5b01..0ff9050 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -57,13 +57,20 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
// Change to local toplevel
cmSystemTools::ChangeDirectory(localToplevel.c_str());
+ std::string filePrefix;
+ if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
+ {
+ filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ filePrefix += "/";
+ }
std::vector<std::string>::const_iterator fileIt;
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
++fileIt )
{
+ std::string rp = filePrefix + *fileIt;
cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: "
- << (*fileIt) << std::endl);
- archive.Add(*fileIt);
+ << rp << std::endl);
+ archive.Add(rp);
if (!archive)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx
new file mode 100644
index 0000000..ddc75a4
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentMacros.cxx
@@ -0,0 +1,16 @@
+#include "cmCPackDocumentMacros.h"
+
+void cmCPackDocumentMacros::GetMacrosDocumentation(
+ std::vector<cmDocumentationEntry>& )
+{
+ // Commented-out example of use
+ //
+ // cmDocumentationEntry e("cpack_<macro>",
+ // "Brief Description"
+ // "which may be on several lines.",
+ // "Long description in pre-formatted format"
+ // " blah\n"
+ // " blah\n"
+ //);
+ //v.push_back(e);
+}
diff --git a/Source/CPack/cmCPackDocumentMacros.h b/Source/CPack/cmCPackDocumentMacros.h
new file mode 100644
index 0000000..544f74f
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentMacros.h
@@ -0,0 +1,21 @@
+/*============================================================================
+ 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 cmCPackDocumentMacros_h
+#define cmCPackDocumentMacros_h
+#include "cmStandardIncludes.h"
+class cmCPackDocumentMacros
+{
+public:
+ static void GetMacrosDocumentation(std::vector<cmDocumentationEntry>& v);
+};
+
+#endif
diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx
new file mode 100644
index 0000000..68cde78
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentVariables.cxx
@@ -0,0 +1,32 @@
+#include "cmCPackDocumentVariables.h"
+#include "cmake.h"
+
+void cmCPackDocumentVariables::DefineVariables(cmake* cm)
+{
+ // Subsection: variables defined/used by cpack,
+ // which are common to all CPack generators
+
+ cm->DefineProperty
+ ("CPACK_PACKAGING_INSTALL_PREFIX", cmProperty::VARIABLE,
+ "The prefix used in the built package.",
+ "Each CPack generator has a default value (like /usr)."
+ " This default value may"
+ " be overwritten from the CMakeLists.txt or the cpack command line"
+ " by setting an alternative value.\n"
+ "e.g. "
+ " set(CPACK_PACKAGING_INSTALL_PREFIX \"/opt\")\n"
+ "This is not the same purpose as CMAKE_INSTALL_PREFIX which"
+ " is used when installing from the build tree without building"
+ " a package."
+ "", false,
+ "Variables common to all CPack generators");
+
+ // Subsection: variables defined/used by cpack,
+ // which are specific to one CPack generator
+// cm->DefineProperty
+// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE,
+// "RPM specific package name.",
+// "If not specified, defaults to CPACK_PACKAGE_NAME."
+// "", false,
+// "Variables specific to a CPack generator");
+}
diff --git a/Source/CPack/cmCPackDocumentVariables.h b/Source/CPack/cmCPackDocumentVariables.h
new file mode 100644
index 0000000..e7971be
--- /dev/null
+++ b/Source/CPack/cmCPackDocumentVariables.h
@@ -0,0 +1,21 @@
+/*============================================================================
+ 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 cmCPackDocumentVariables_h
+#define cmCPackDocumentVariables_h
+class cmake;
+class cmCPackDocumentVariables
+{
+public:
+ static void DefineVariables(cmake* cm);
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 083279f..f7d8a4d 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -691,6 +691,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// one install directory for each component.
tempInstallDirectory +=
GetComponentInstallDirNameSuffix(installComponent);
+ if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
+ {
+ tempInstallDirectory += "/";
+ tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ }
}
if (!setDestDir)
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 2b94067..0787ef9 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -344,9 +344,9 @@ int cmCPackNSISGenerator::InitializeInternal()
if ( cmSystemTools::IsOn(this->GetOption(
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) )
{
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. "
- "This option will be ignored."
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
+ "This option will be reset to 0 (for this generator only)."
<< std::endl);
this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 163f744..6f5055c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -14,6 +14,8 @@
// Need these for documentation support.
#include "cmake.h"
#include "cmDocumentation.h"
+#include "cmCPackDocumentVariables.h"
+#include "cmCPackDocumentMacros.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackGenerator.h"
#include "cmake.h"
@@ -24,6 +26,7 @@
#include "cmCPackLog.h"
#include <cmsys/CommandLineArguments.hxx>
+#include <cmsys/SystemTools.hxx>
#include <memory> // auto_ptr
//----------------------------------------------------------------------------
@@ -90,6 +93,40 @@ static const char * cmDocumentationOptions[][3] =
"If vendor is not specified on cpack command line "
"(or inside CMakeLists.txt) then"
"CPack.cmake defines it with a default value"},
+ {"--help-command cmd [file]", "Print help for a single command and exit.",
+ "Full documentation specific to the given command is displayed. "
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-command-list [file]", "List available commands and exit.",
+ "The list contains all commands for which help may be obtained by using "
+ "the --help-command argument followed by a command name. "
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-commands [file]", "Print help for all commands and exit.",
+ "Full documentation specific for all current command is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variable var [file]",
+ "Print help for a single variable and exit.",
+ "Full documentation specific to the given variable is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variable-list [file]", "List documented variables and exit.",
+ "The list contains all variables for which help may be obtained by using "
+ "the --help-variable argument followed by a variable name. If a file is "
+ "specified, the help is written into it."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
+ {"--help-variables [file]", "Print help for all variables and exit.",
+ "Full documentation for all variables is displayed."
+ "If a file is specified, the documentation is written into and the output "
+ "format is determined depending on the filename suffix. Supported are man "
+ "page, HTML, DocBook and plain text."},
{0,0,0}
};
@@ -137,12 +174,15 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
return 1;
}
+
//----------------------------------------------------------------------------
// this is CPack.
int main (int argc, char *argv[])
{
cmSystemTools::FindExecutableDirectory(argv[0]);
cmCPackLog log;
+ int nocwd = 0;
+
log.SetErrorPrefix("CPack Error: ");
log.SetWarningPrefix("CPack Warning: ");
log.SetOutputPrefix("CPack: ");
@@ -154,6 +194,7 @@ int main (int argc, char *argv[])
{
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established." << std::endl);
+ nocwd = 1;
}
std::string generator;
@@ -179,7 +220,6 @@ int main (int argc, char *argv[])
cpackConfigFile = "";
- cmDocumentation doc;
cmsys::CommandLineArguments arg;
arg.Initialize(argc, argv);
typedef cmsys::CommandLineArguments argT;
@@ -252,17 +292,25 @@ int main (int argc, char *argv[])
generators.SetLogger(&log);
cmCPackGenerator* cpackGenerator = 0;
- if ( !helpFull.empty() || !helpMAN.empty() ||
- !helpHTML.empty() || helpVersion )
+ cmDocumentation doc;
+ doc.addCPackStandardDocSections();
+ /* Were we invoked to display doc or to do some work ? */
+ if(doc.CheckOptions(argc, argv,"-G") || nocwd)
{
- help = true;
+ help = true;
}
+ else
+ {
+ help = false;
+ }
+
+ // This part is used for cpack documentation lookup as well.
+ cminst.AddCMakePaths();
if ( parsed && !help )
{
// find out which system cpack is running on, so it can setup the search
// paths, so FIND_XXX() commands can be used in scripts
- cminst.AddCMakePaths();
std::string systemFile =
globalMF->GetModulesFile("CMakeDetermineSystem.cmake");
if (!globalMF->ReadListFile(0, systemFile.c_str()))
@@ -465,14 +513,48 @@ int main (int argc, char *argv[])
*/
if ( help )
{
- doc.CheckOptions(argc, argv);
// Construct and print requested documentation.
+
doc.SetName("cpack");
doc.SetSection("Name",cmDocumentationName);
doc.SetSection("Usage",cmDocumentationUsage);
doc.SetSection("Description",cmDocumentationDescription);
doc.PrependSection("Options",cmDocumentationOptions);
+ // statically (in C++ code) defined variables
+ cmCPackDocumentVariables::DefineVariables(&cminst);
+
+ std::vector<cmDocumentationEntry> commands;
+
+ std::string docedFile;
+ std::string docPath;
+ cmDocumentation::documentedModulesList_t docedModList;
+
+ docedFile = globalMF->GetModulesFile("CPack.cmake");
+ if (docedFile.length()!=0)
+ {
+ docPath = cmSystemTools::GetFilenamePath(docedFile.c_str());
+ doc.getDocumentedModulesListInDir(docPath,"CPack*.cmake",docedModList);
+ }
+
+ // parse the files for documentation.
+ cmDocumentation::documentedModulesList_t::iterator docedIt;
+ for (docedIt = docedModList.begin();
+ docedIt!= docedModList.end(); ++docedIt)
+ {
+ doc.GetStructuredDocFromFile(
+ (docedIt->first).c_str(),
+ commands,&cminst);
+ }
+
+ std::map<std::string,cmDocumentationSection *> propDocs;
+ cminst.GetPropertiesDocumentation(propDocs);
+ doc.SetSections(propDocs);
+ cminst.GetCommandDocumentation(commands,true,false);
+ // statically (in C++ code) defined macros/commands
+ cmCPackDocumentMacros::GetMacrosDocumentation(commands);
+ doc.SetSection("Commands",commands);
+
std::vector<cmDocumentationEntry> v;
cmCPackGeneratorFactory::DescriptionsMap::const_iterator generatorIt;
for( generatorIt = generators.GetGeneratorsList().begin();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 0b1c9fe..309abb1 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -555,7 +555,7 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumFile << "\t<File Name=\"" << cmXMLSafe(fileName)
<< "\" FullPath=\"" << cmXMLSafe(
this->CTest->GetShortPathToFile(fullFileName.c_str()))
- << "\" Covered=\"" << (tested > 0 ? "true":"false") << "\">\n"
+ << "\" Covered=\"" << (tested+untested > 0 ? "true":"false") << "\">\n"
<< "\t\t<LOCTested>" << tested << "</LOCTested>\n"
<< "\t\t<LOCUnTested>" << untested << "</LOCUnTested>\n"
<< "\t\t<PercentCoverage>";
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index b1a72af..623d7d3 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -102,6 +102,7 @@ int main(int argc, char** argv)
{
cmSystemTools::FindExecutableDirectory(argv[0]);
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(doc.CheckOptions(argc, argv))
{
cmake hcm;
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 6c7627f..4fee0bb 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -409,12 +409,11 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */)
char thirdLine[512]="";
if (process)
{
- sprintf(firstLine,
- " ");
- sprintf(secondLine,
- " ");
- sprintf(thirdLine,
- " ");
+ const char* clearLine =
+ " ";
+ strcpy(firstLine, clearLine);
+ strcpy(secondLine, clearLine);
+ strcpy(thirdLine, clearLine);
}
else
{
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 4785188..056e48e 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -10,11 +10,11 @@
# See the License for more information.
#=============================================================================
PROJECT(QtDialog)
-SET(QT_MIN_VERSION "4.3.0")
+SET(QT_MIN_VERSION "4.4.0")
FIND_PACKAGE(Qt4 REQUIRED)
IF(NOT QT4_FOUND)
- MESSAGE(SEND_ERROR "Failed to find Qt 4.3 or greater.")
+ MESSAGE(SEND_ERROR "Failed to find Qt 4.4 or greater.")
ELSE(NOT QT4_FOUND)
INCLUDE(${QT_USE_FILE})
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 7ba7f51..b4f3d72 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -64,6 +64,7 @@ int main(int argc, char** argv)
// check docs first so that X is not need to get docs
// do docs, if args were given
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(argc >1 && doc.CheckOptions(argc, argv))
{
// Construct and print requested documentation.
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 338eaff..45b4cd3 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -554,8 +554,7 @@ void CMakeSetupDialog::doHelp()
void CMakeSetupDialog::doInterrupt()
{
this->enterState(Interrupting);
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "interrupt", Qt::QueuedConnection);
+ this->CMakeThread->cmakeInstance()->interrupt();
}
void CMakeSetupDialog::doSourceBrowse()
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index a40a175..73050f3 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -63,6 +63,8 @@ QCMake::QCMake(QObject* p)
#endif
this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
+ cmSystemTools::SetInterruptCallback(QCMake::interruptCallback, this);
+
std::vector<std::string> generators;
this->CMakeInstance->GetRegisteredGenerators(generators);
std::vector<std::string>::iterator iter;
@@ -170,6 +172,7 @@ void QCMake::configure()
this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
this->CMakeInstance->PreLoadCMakeFiles();
+ InterruptFlag = 0;
cmSystemTools::ResetErrorOccuredFlag();
int err = this->CMakeInstance->Configure();
@@ -188,7 +191,9 @@ void QCMake::generate()
UINT lastErrorMode = SetErrorMode(0);
#endif
+ InterruptFlag = 0;
cmSystemTools::ResetErrorOccuredFlag();
+
int err = this->CMakeInstance->Generate();
#ifdef Q_OS_WIN
@@ -337,7 +342,13 @@ QCMakePropertyList QCMake::properties() const
void QCMake::interrupt()
{
- cmSystemTools::SetFatalErrorOccured();
+ this->InterruptFlag.ref();
+}
+
+bool QCMake::interruptCallback(void* cd)
+{
+ QCMake* self = reinterpret_cast<QCMake*>(cd);
+ return self->InterruptFlag;
}
void QCMake::progressCallback(const char* msg, float percent, void* cd)
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 0d10823..0d68586 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -23,6 +23,7 @@
#include <QList>
#include <QStringList>
#include <QMetaType>
+#include <QAtomicInt>
class cmake;
@@ -78,7 +79,7 @@ public slots:
void generate();
/// set the property values
void setProperties(const QCMakePropertyList&);
- /// interrupt the configure or generate process
+ /// interrupt the configure or generate process (if connecting, make a direct connection)
void interrupt();
/// delete the cache in binary directory
void deleteCache();
@@ -133,6 +134,7 @@ signals:
protected:
cmake* CMakeInstance;
+ static bool interruptCallback(void*);
static void progressCallback(const char* msg, float percent, void* cd);
static void errorCallback(const char* msg, const char* title,
bool&, void* cd);
@@ -145,6 +147,7 @@ protected:
QString Generator;
QStringList AvailableGenerators;
QString CMakeExecutable;
+ QAtomicInt InterruptFlag;
};
#endif // __QCMake_h
diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx
index 554f452..9097a74 100644
--- a/Source/cmBootstrapCommands.cxx
+++ b/Source/cmBootstrapCommands.cxx
@@ -12,7 +12,7 @@
// This file is used to compile all the commands
// that CMake knows about at compile time.
// This is sort of a boot strapping approach since you would
-// like to have CMake to build CMake.
+// like to have CMake to build CMake.
#include "cmCommands.h"
#include "cmAddCustomCommandCommand.cxx"
#include "cmAddCustomTargetCommand.cxx"
@@ -38,6 +38,7 @@
#include "cmEndFunctionCommand.cxx"
#include "cmEndIfCommand.cxx"
#include "cmEndMacroCommand.cxx"
+#include "cmEndWhileCommand.cxx"
#include "cmExecProgramCommand.cxx"
#include "cmExecuteProcessCommand.cxx"
#include "cmExternalMakefileProjectGenerator.cxx"
@@ -91,6 +92,7 @@
#include "cmTryCompileCommand.cxx"
#include "cmTryRunCommand.cxx"
#include "cmUnsetCommand.cxx"
+#include "cmWhileCommand.cxx"
void GetBootstrapCommands(std::list<cmCommand*>& commands)
{
@@ -111,11 +113,12 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmElseCommand);
commands.push_back(new cmEnableLanguageCommand);
- commands.push_back(new cmEnableTestingCommand);
+ commands.push_back(new cmEnableTestingCommand);
commands.push_back(new cmEndForEachCommand);
commands.push_back(new cmEndFunctionCommand);
commands.push_back(new cmEndIfCommand);
commands.push_back(new cmEndMacroCommand);
+ commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExecProgramCommand);
commands.push_back(new cmExecuteProcessCommand);
commands.push_back(new cmFileCommand);
@@ -164,4 +167,5 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmTryCompileCommand);
commands.push_back(new cmTryRunCommand);
commands.push_back(new cmUnsetCommand);
+ commands.push_back(new cmWhileCommand);
}
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 7817eb3..e046096 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -111,6 +111,17 @@ public:
}
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return true;
+ }
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() = 0;
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index bb1e4e2..49ed967 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -14,7 +14,6 @@
#include "cmAuxSourceDirectoryCommand.cxx"
#include "cmBuildNameCommand.cxx"
#include "cmElseIfCommand.cxx"
-#include "cmEndWhileCommand.cxx"
#include "cmExportCommand.cxx"
#include "cmExportLibraryDependencies.cxx"
#include "cmFLTKWrapUICommand.cxx"
@@ -34,7 +33,6 @@
#include "cmVariableRequiresCommand.cxx"
#include "cmVariableWatchCommand.cxx"
-#include "cmWhileCommand.cxx"
#include "cmWriteFileCommand.cxx"
// This one must be last because it includes windows.h and
@@ -53,7 +51,6 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
commands.push_back(new cmElseIfCommand);
- commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
commands.push_back(new cmFLTKWrapUICommand);
@@ -73,7 +70,6 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmUtilitySourceCommand);
commands.push_back(new cmVariableRequiresCommand);
commands.push_back(new cmVariableWatchCommand);
- commands.push_back(new cmWhileCommand);
commands.push_back(new cmWriteFileCommand);
#endif
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index edf6c35..57fd5b4 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -248,6 +248,10 @@ cmComputeLinkInformation
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
+ // Check whether to recognize OpenBSD-style library versioned names.
+ this->OpenBSD = this->Makefile->GetCMakeInstance()
+ ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
+
// The configuration being linked.
this->Config = config;
@@ -973,7 +977,15 @@ cmComputeLinkInformation
}
// Finish the list.
- libext += ")$";
+ libext += ")";
+
+ // Add an optional OpenBSD version component.
+ if(this->OpenBSD)
+ {
+ libext += "(\\.[0-9]+\\.[0-9]+)?";
+ }
+
+ libext += "$";
return libext;
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index bbeed68..f60f8d3 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -128,6 +128,7 @@ private:
cmsys::RegularExpression ExtractSharedLibraryName;
cmsys::RegularExpression ExtractAnyLibraryName;
std::string SharedRegexString;
+ bool OpenBSD;
void AddLinkPrefix(const char* p);
void AddLinkExtension(const char* e, LinkType type);
std::string CreateExtensionRegex(std::vector<std::string> const& exts);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index dca2fb3..7d84ba6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -26,6 +26,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* sourceDirectory = argv[2].c_str();
const char* projectName = 0;
const char* targetName = 0;
+ char targetNameBuf[64];
int extraArgs = 0;
// look for CMAKE_FLAGS and store them
@@ -281,16 +282,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmakeFlags.push_back(flag);
}
+ /* Use a random file name to avoid rapid creation and deletion
+ of the same executable name (some filesystems fail on that). */
+ sprintf(targetNameBuf, "cmTryCompileExec%u",
+ cmSystemTools::RandomSeed());
+ targetName = targetNameBuf;
+
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
- fprintf(fout,
- "TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})\n");
+ fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
+ fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
- targetName = "cmTryCompileExec";
// if the source is not in CMakeTmp
if(source.find("CMakeTmp") == source.npos)
{
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 19558fa..94ff471 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -260,12 +260,24 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
//----------------------------------------------------------------------------
void cmDepends::SetIncludePathFromLanguage(const char* lang)
{
+ // Look for the new per "TARGET_" variant first:
std::string includePathVar = "CMAKE_";
includePathVar += lang;
- includePathVar += "_INCLUDE_PATH";
+ includePathVar += "_TARGET_INCLUDE_PATH";
cmMakefile* mf = this->LocalGenerator->GetMakefile();
if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
{
cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
}
+ else
+ {
+ // Fallback to the old directory level variable if no per-target var:
+ includePathVar = "CMAKE_";
+ includePathVar += lang;
+ includePathVar += "_INCLUDE_PATH";
+ if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
+ {
+ cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
+ }
+ }
}
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 07683d0..904a157 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -14,7 +14,9 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/Glob.hxx>
+#include <algorithm>
//----------------------------------------------------------------------------
static const char *cmDocumentationStandardOptions[][3] =
@@ -220,55 +222,7 @@ cmDocumentation::cmDocumentation()
:CurrentFormatter(0)
{
this->SetForm(TextForm);
-
- cmDocumentationSection *sec;
-
- sec = new cmDocumentationSection("Author","AUTHOR");
- sec->Append(cmDocumentationEntry
- (0,
- "This manual page was generated by the \"--help-man\" option.",
- 0));
- this->AllSections["Author"] = sec;
-
- sec = new cmDocumentationSection("Copyright","COPYRIGHT");
- sec->Append(cmDocumentationCopyright);
- this->AllSections["Copyright"] = sec;
-
- sec = new cmDocumentationSection("See Also","SEE ALSO");
- sec->Append(cmDocumentationStandardSeeAlso);
- this->AllSections["Standard See Also"] = sec;
-
- sec = new cmDocumentationSection("Options","OPTIONS");
- sec->Append(cmDocumentationStandardOptions);
- this->AllSections["Options"] = sec;
-
- sec = new cmDocumentationSection("Properties","PROPERTIES");
- sec->Append(cmPropertiesDocumentationDescription);
- this->AllSections["Properties Description"] = sec;
-
- sec = new cmDocumentationSection("Generators","GENERATORS");
- sec->Append(cmDocumentationGeneratorsHeader);
- this->AllSections["Generators"] = sec;
-
- sec = new cmDocumentationSection("Compatibility Commands",
- "COMPATIBILITY COMMANDS");
- sec->Append(cmCompatCommandsDocumentationDescription);
- this->AllSections["Compatibility Commands"] = sec;
-
-
- this->PropertySections.push_back("Properties of Global Scope");
- this->PropertySections.push_back("Properties on Directories");
- this->PropertySections.push_back("Properties on Targets");
- this->PropertySections.push_back("Properties on Tests");
- this->PropertySections.push_back("Properties on Source Files");
- this->PropertySections.push_back("Properties on Cache Entries");
-
- this->VariableSections.push_back("Variables that Provide Information");
- this->VariableSections.push_back("Variables That Change Behavior");
- this->VariableSections.push_back("Variables That Describe the System");
- this->VariableSections.push_back("Variables that Control the Build");
- this->VariableSections.push_back("Variables for Languages");
-
+ this->addCommonStandardDocSections();
this->ShowGenerators = true;
}
@@ -559,6 +513,8 @@ bool cmDocumentation::CreateSingleModule(const char* fname,
{
if(line.size() && line[0] == '#')
{
+ /* line beginnings with ## are mark-up ignore them */
+ if (line.size()>=2 && line[1] == '#') continue;
// blank line
if(line.size() <= 2)
{
@@ -710,6 +666,423 @@ cmDocumentation::Form cmDocumentation::GetFormFromFilename(
}
//----------------------------------------------------------------------------
+void cmDocumentation::addCommonStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Author","AUTHOR");
+ sec->Append(cmDocumentationEntry
+ (0,
+ "This manual page was generated by the \"--help-man\" option.",
+ 0));
+ this->AllSections["Author"] = sec;
+
+ sec = new cmDocumentationSection("Copyright","COPYRIGHT");
+ sec->Append(cmDocumentationCopyright);
+ this->AllSections["Copyright"] = sec;
+
+ sec = new cmDocumentationSection("See Also","SEE ALSO");
+ sec->Append(cmDocumentationStandardSeeAlso);
+ this->AllSections["Standard See Also"] = sec;
+
+ sec = new cmDocumentationSection("Options","OPTIONS");
+ sec->Append(cmDocumentationStandardOptions);
+ this->AllSections["Options"] = sec;
+
+ sec = new cmDocumentationSection("Compatibility Commands",
+ "COMPATIBILITY COMMANDS");
+ sec->Append(cmCompatCommandsDocumentationDescription);
+ this->AllSections["Compatibility Commands"] = sec;
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCMakeStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Properties","PROPERTIES");
+ sec->Append(cmPropertiesDocumentationDescription);
+ this->AllSections["Properties Description"] = sec;
+
+ sec = new cmDocumentationSection("Generators","GENERATORS");
+ sec->Append(cmDocumentationGeneratorsHeader);
+ this->AllSections["Generators"] = sec;
+
+ this->PropertySections.push_back("Properties of Global Scope");
+ this->PropertySections.push_back("Properties on Directories");
+ this->PropertySections.push_back("Properties on Targets");
+ this->PropertySections.push_back("Properties on Tests");
+ this->PropertySections.push_back("Properties on Source Files");
+ this->PropertySections.push_back("Properties on Cache Entries");
+
+ this->VariableSections.push_back("Variables that Provide Information");
+ this->VariableSections.push_back("Variables That Change Behavior");
+ this->VariableSections.push_back("Variables That Describe the System");
+ this->VariableSections.push_back("Variables that Control the Build");
+ this->VariableSections.push_back("Variables for Languages");
+
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCTestStandardDocSections()
+{
+ // This is currently done for backward compatibility reason
+ // We may suppress some of these.
+ addCMakeStandardDocSections();
+}
+
+//----------------------------------------------------------------------------
+void cmDocumentation::addCPackStandardDocSections()
+{
+ cmDocumentationSection *sec;
+
+ sec = new cmDocumentationSection("Generators","GENERATORS");
+ sec->Append(cmDocumentationGeneratorsHeader);
+ this->AllSections["Generators"] = sec;
+
+ this->VariableSections.push_back(
+ "Variables common to all CPack generators");
+}
+
+void cmDocumentation::addAutomaticVariableSections(const std::string& section)
+{
+ std::vector<std::string>::iterator it;
+ it = std::find(this->VariableSections.begin(),
+ this->VariableSections.end(),
+ section);
+ /* if the section does not exist then add it */
+ if (it==this->VariableSections.end())
+ {
+ this->VariableSections.push_back(section);
+ }
+}
+//----------------------------------------------------------------------------
+int cmDocumentation::getDocumentedModulesListInDir(
+ std::string path,
+ std::string globExpr,
+ documentedModulesList_t& docedModuleList)
+{
+ cmsys::Glob gl;
+ std::string findExpr;
+ std::vector<std::string> files;
+ std::string line;
+ documentedModuleSectionPair_t docPair;
+ int nbDocumentedModules = 0;
+
+ findExpr = path + "/" + globExpr;
+ if (gl.FindFiles(findExpr))
+ {
+ files = gl.GetFiles();
+ for (std::vector<std::string>::iterator itf=files.begin();
+ itf!=files.end();++itf)
+ {
+ std::ifstream fin((*itf).c_str());
+ // file access trouble ignore it (ignore this kind of error)
+ if (!fin) continue;
+ /* read first line in order to get doc section */
+ if (cmSystemTools::GetLineFromStream(fin, line))
+ {
+ /* Doc section indicates that
+ * this file has structured doc in it.
+ */
+ if (line.find("##section")!=std::string::npos)
+ {
+ // ok found one more documented module
+ ++nbDocumentedModules;
+ docPair.first = *itf;
+ // 10 is the size of '##section' + 1
+ docPair.second = line.substr(10,std::string::npos);
+ docedModuleList.push_back(docPair);
+ }
+ // No else if no section is found (undocumented module)
+ }
+ // No else cannot read first line (ignore this kind of error)
+ line = "";
+ }
+ }
+ if (nbDocumentedModules>0)
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+//----------------------------------------------------------------------------
+static void trim(std::string& s)
+{
+ std::string::size_type pos = s.find_last_not_of(' ');
+ if(pos != std::string::npos)
+ {
+ s.erase(pos + 1);
+ pos = s.find_first_not_of(' ');
+ if(pos != std::string::npos) s.erase(0, pos);
+ }
+ else
+ {
+ s.erase(s.begin(), s.end());
+ }
+}
+
+int cmDocumentation::GetStructuredDocFromFile(
+ const char* fname,
+ std::vector<cmDocumentationEntry>& commands,
+ cmake* cm)
+{
+ typedef enum sdoce {
+ SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE,
+ SDOC_SECTION,
+ SDOC_UNKNOWN} sdoc_t;
+ int nbDocItemFound = 0;
+ int docCtxIdx = 0;
+ std::vector<int> docContextStack(60);
+ docContextStack[docCtxIdx]=SDOC_NONE;
+ cmDocumentationEntry e;
+ std::ifstream fin(fname);
+ if(!fin)
+ {
+ return nbDocItemFound;
+ }
+ std::string section;
+ std::string name;
+ std::string full;
+ std::string brief;
+ std::string line;
+ bool newCtx = false; /* we've just entered ##<beginkey> context */
+ bool inBrief = false; /* we are currently parsing brief desc. */
+ bool inFullFirstParagraph = false; /* we are currently parsing full
+ desc. first paragraph */
+ brief = "";
+ full = "";
+ bool newParagraph = true;
+ while ( fin && cmSystemTools::GetLineFromStream(fin, line) )
+ {
+ if(line.size() && line[0] == '#')
+ {
+ /* handle structured doc context */
+ if ((line.size()>=2) && line[1]=='#')
+ {
+ /* markup word is following '##' stopping at first space
+ * Some markup word like 'section' may have more characters
+ * following but we don't handle those here.
+ */
+ std::string mkword = line.substr(2,line.find(' ',2)-2);
+ if (mkword=="macro")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_MACRO;
+ newCtx = true;
+ }
+ else if (mkword=="variable")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_VARIABLE;
+ newCtx = true;
+ }
+ else if (mkword=="function")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_FUNCTION;
+ newCtx = true;
+ }
+ else if (mkword=="module")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_MODULE;
+ newCtx = true;
+ }
+ else if (mkword=="section")
+ {
+ docCtxIdx++;
+ docContextStack[docCtxIdx]=SDOC_SECTION;
+ // 10 is the size of '##section' + 1
+ section = line.substr(10,std::string::npos);
+ /* drop the rest of the line */
+ line = "";
+ newCtx = true;
+ }
+ else if (mkword.substr(0,3)=="end")
+ {
+ switch (docContextStack[docCtxIdx]) {
+ case SDOC_MACRO:
+ /* for now MACRO and FUNCTION are handled in the same way */
+ case SDOC_FUNCTION:
+ commands.push_back(cmDocumentationEntry(name.c_str(),
+ brief.c_str(),full.c_str()));
+ break;
+ case SDOC_VARIABLE:
+ this->addAutomaticVariableSections(section);
+ cm->DefineProperty
+ (name.c_str(), cmProperty::VARIABLE,
+ brief.c_str(),
+ full.c_str(),false,
+ section.c_str());
+ break;
+ case SDOC_MODULE:
+ /* not implemented */
+ break;
+ case SDOC_SECTION:
+ /* not implemented */
+ break;
+ default:
+ /* ignore other cases */
+ break;
+ }
+ docCtxIdx--;
+ newCtx = false;
+ ++nbDocItemFound;
+ }
+ else
+ {
+ // error out unhandled context
+ return nbDocItemFound;
+ }
+ /* context is set go to next doc line */
+ continue;
+ }
+
+ // Now parse the text attached to the context
+
+ // The first line after the context mark-up contains::
+ // name - brief until. (brief is dot terminated or
+ // followed by a blank line)
+ if (newCtx)
+ {
+ // no brief (for easy variable definition)
+ if (line.find("-")==std::string::npos)
+ {
+ name = line.substr(1,std::string::npos);
+ trim(name);
+ brief = "";
+ inBrief = false;
+ full = "";
+ }
+ // here we have a name and brief beginning
+ else
+ {
+ name = line.substr(1,line.find("-")-1);
+ trim(name);
+ // we are parsing the brief context
+ brief = line.substr(line.find("-")+1,std::string::npos);
+ trim(brief);
+ // Brief may already be terminated on the first line
+ if (brief.find('.')!=std::string::npos)
+ {
+ inBrief = false;
+ full = brief.substr(brief.find('.')+1,std::string::npos);
+ trim(full);
+ inFullFirstParagraph = true;
+ brief = brief.substr(0,brief.find('.'));
+ }
+ // brief is continued on following lines
+ else
+ {
+ inBrief = true;
+ full = "";
+ }
+ }
+ newCtx = false;
+ continue;
+ }
+ // blank line
+ if(line.size() <= 2)
+ {
+ if (inBrief) {
+ inBrief = false;
+ full = "";
+ } else {
+ if (full.length()>0)
+ {
+ full += "\n";
+ }
+ // the first paragraph of full has ended
+ inFullFirstParagraph = false;
+ }
+ newParagraph = true;
+ }
+ // brief is terminated by '.'
+ else if (inBrief && (line.find('.')!=std::string::npos))
+ {
+ /* the brief just ended */
+ inBrief = false;
+ std::string endBrief = line.substr(1,line.find('.'));
+ trim(endBrief);
+ trim(brief);
+ brief += " " + endBrief;
+ full += line.substr(line.find('.')+1,std::string::npos);
+ trim(full);
+ inFullFirstParagraph = true;
+ }
+ // we handle full text or multi-line brief.
+ else
+ {
+ std::string* text;
+ if (inBrief)
+ {
+ text = &brief;
+ }
+ else
+ {
+ text = &full;
+ }
+ // two spaces
+ if(line[1] == ' ' && line[2] == ' ')
+ {
+ // there is no "full first paragraph at all."
+ if (line[3] == ' ')
+ {
+ inFullFirstParagraph = false;
+ }
+
+ if(!newParagraph && !inFullFirstParagraph)
+ {
+ *text += "\n";
+ newParagraph = true;
+ }
+ // Skip #, and leave space for pre-formatted
+ if (inFullFirstParagraph)
+ {
+ std::string temp = line.c_str()+1;
+ trim(temp);
+ *text += " " + temp;
+ }
+ else
+ {
+ *text += line.c_str()+1;
+ *text += "\n";
+ }
+ }
+ else if(line[1] == ' ')
+ {
+ if(!newParagraph)
+ {
+ *text += " ";
+ }
+ newParagraph = false;
+ // skip # and space
+ *text += line.c_str()+2;
+ }
+ else
+ {
+ if(!newParagraph)
+ {
+ *text += " ";
+ }
+ newParagraph = false;
+ // skip #
+ *text += line.c_str()+1;
+ }
+ }
+ }
+ /* next line is not the first context line */
+ newCtx = false;
+ }
+ return nbDocItemFound;
+}
+
+//----------------------------------------------------------------------------
bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
const char* exitOpt)
{
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 34b83b1..11bef16 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -21,6 +21,7 @@
#include "cmDocumentationFormatterText.h"
#include "cmDocumentationFormatterUsage.h"
#include "cmDocumentationSection.h"
+#include "cmake.h"
namespace cmsys
{
@@ -34,6 +35,21 @@ public:
cmDocumentation();
~cmDocumentation();
+
+ /**
+ * An helper type pair for [structured] documented modules.
+ * The comment of those module contains structure markup
+ * which makes it possible to retrieve the documentation
+ * of variables, macros and functions defined in the module.
+ * - first is the filename of the module
+ * - second is the section of the doc the module belongs too
+ */
+ typedef std::pair<std::string,std::string> documentedModuleSectionPair_t;
+ /**
+ * A list of documented module(s).
+ */
+ typedef std::list<documentedModuleSectionPair_t> documentedModulesList_t;
+
// High-level interface for standard documents:
/**
@@ -119,6 +135,60 @@ public:
static Form GetFormFromFilename(const std::string& filename);
+ /** Add common (to all tools) documentation section(s) */
+ void addCommonStandardDocSections();
+
+ /** Add the CMake standard documentation section(s) */
+ void addCMakeStandardDocSections();
+
+ /** Add the CTest standard documentation section(s) */
+ void addCTestStandardDocSections();
+
+ /** Add the CPack standard documentation section(s) */
+ void addCPackStandardDocSections();
+
+ /** Add automatic variables sections */
+ void addAutomaticVariableSections(const std::string& section);
+
+ /**
+ * Retrieve the list of documented module located in
+ * path which match the globing expression globExpr.
+ * @param[in] path, directory where to start the search
+ * we will recurse into it.
+ * @param[in] globExpr, the globing expression used to
+ * match the file in path.
+ * @param[out] the list of obtained pairs (may be empty)
+ * @return 0 on success 1 on error or empty list
+ */
+ int getDocumentedModulesListInDir(
+ std::string path,
+ std::string globExpr,
+ documentedModulesList_t& docModuleList);
+
+ /**
+ * Get the documentation of macros, functions and variable documented
+ * with CMake structured documentation in a CMake script.
+ * (in fact it may be in any file which follow the structured doc format)
+ * Structured documentation begin with
+ * ## (double sharp) in column 1 & 2 immediately followed
+ * by a markup. Those ## are ignored by the legacy module
+ * documentation parser @see CreateSingleModule.
+ * Current markup are ##section, ##module,
+ * ##macro, ##function, ##variable and ##end.
+ * ##end is closing either of the previous ones.
+ * @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.
+ * @return the number of documented items (command and variable)
+ * found in the file.
+ */
+ int GetStructuredDocFromFile(const char* fname,
+ std::vector<cmDocumentationEntry>& commands,
+ cmake* cm);
private:
void SetForm(Form f);
void SetDocName(const char* docname);
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 38002ec..b5cba8e 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -600,16 +600,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
// the include directories for this target
std::set<std::string> uniqIncludeDirs;
- const std::vector<std::string>& incDirs =
- target->GetMakefile()->GetIncludeDirectories();
- for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
- dirIt != incDirs.end();
+
+ std::vector<std::string> includes;
+ target->GetMakefile()->GetLocalGenerator()->
+ GetIncludeDirectories(includes, target);
+ for(std::vector<std::string>::const_iterator dirIt=includes.begin();
+ dirIt != includes.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
-
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty())
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 07549e9..19372c8 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -893,9 +893,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end();
++it)
{
- const std::vector<std::string>& includeDirs
- = (*it)->GetMakefile()->GetIncludeDirectories();
- this->AppendIncludeDirectories(fout, includeDirs, emmited);
+ cmTargets & targets = (*it)->GetMakefile()->GetTargets();
+ for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
+ {
+ std::vector<std::string> includeDirs;
+ (*it)->GetIncludeDirectories(includeDirs, &l->second);
+ this->AppendIncludeDirectories(fout, includeDirs, emmited);
+ }
}
// now also the system include directories, in case we found them in
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 2fa2cca..a726849 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -354,13 +354,23 @@ void cmFindLibraryHelper::RegexFromList(std::string& out,
//----------------------------------------------------------------------------
bool cmFindLibraryHelper::HasValidSuffix(std::string const& name)
{
- // Check if the given name ends in a valid library suffix.
for(std::vector<std::string>::const_iterator si = this->Suffixes.begin();
si != this->Suffixes.end(); ++si)
{
- std::string const& suffix = *si;
- if(name.length() > suffix.length() &&
- name.substr(name.size()-suffix.length()) == suffix)
+ std::string suffix = *si;
+ if(name.length() <= suffix.length())
+ {
+ continue;
+ }
+ // Check if the given name ends in a valid library suffix.
+ if(name.substr(name.size()-suffix.length()) == suffix)
+ {
+ return true;
+ }
+ // Check if a valid library suffix is somewhere in the name,
+ // this may happen e.g. for versioned shared libraries: libfoo.so.2
+ suffix += ".";
+ if(name.find(suffix) != name.npos)
{
return true;
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7d3f09b..22bb628 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1226,6 +1226,15 @@ void cmFindPackageCommand::AppendSuccessInformation()
}
this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(),
versionInfo.c_str());
+ if (this->Required)
+ {
+ std::string requiredInfoPropName = "_CMAKE_";
+ requiredInfoPropName += this->Name;
+ requiredInfoPropName += "_TYPE";
+ this->Makefile->GetCMakeInstance()->SetProperty(
+ requiredInfoPropName.c_str(), "REQUIRED");
+ }
+
// Restore original state of "_FIND_" variables we set.
this->RestoreFindDefinitions();
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index ec4fd16..7a80a1c 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -23,6 +23,17 @@ public:
~cmFunctionHelperCommand() {};
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return false;
+ }
+
+ /**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8dce053..a988844 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1067,9 +1067,9 @@ void cmGlobalGenerator::CheckLocalGenerators()
{
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
this->LocalGenerators[i]->ConfigureFinalPass();
- const cmTargets & targets =
+ cmTargets & targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets();
- for (cmTargets::const_iterator l = targets.begin();
+ for (cmTargets::iterator l = targets.begin();
l != targets.end(); l++)
{
const cmTarget::LinkLibraryVectorType& libs =
@@ -1095,27 +1095,28 @@ void cmGlobalGenerator::CheckLocalGenerators()
notFoundMap[varName] = text;
}
}
- }
- const std::vector<std::string>& incs =
- this->LocalGenerators[i]->GetMakefile()->GetIncludeDirectories();
+ std::vector<std::string> incs;
+ this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second);
- for( std::vector<std::string>::const_iterator incDir = incs.begin();
- incDir != incs.end(); ++incDir)
- {
- if(incDir->size() > 9 &&
- cmSystemTools::IsNOTFOUND(incDir->c_str()))
+ for( std::vector<std::string>::const_iterator incDir = incs.begin();
+ incDir != incs.end(); ++incDir)
{
- std::string varName = incDir->substr(0, incDir->size()-9);
- cmCacheManager::CacheIterator it =
- manager->GetCacheIterator(varName.c_str());
- if(it.GetPropertyAsBool("ADVANCED"))
+ if(incDir->size() > 9 &&
+ cmSystemTools::IsNOTFOUND(incDir->c_str()))
{
- varName += " (ADVANCED)";
+ std::string varName = incDir->substr(0, incDir->size()-9);
+ cmCacheManager::CacheIterator it =
+ manager->GetCacheIterator(varName.c_str());
+ if(it.GetPropertyAsBool("ADVANCED"))
+ {
+ varName += " (ADVANCED)";
+ }
+ std::string text = notFoundMap[varName];
+ text += "\n used as include directory in directory ";
+ text += this->LocalGenerators[i]
+ ->GetMakefile()->GetCurrentDirectory();
+ notFoundMap[varName] = text;
}
- std::string text = notFoundMap[varName];
- text += "\n used as include directory in directory ";
- text += this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
- notFoundMap[varName] = text;
}
}
this->CMakeInstance->UpdateProgress
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 859503f..cb74746 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1811,7 +1811,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
std::vector<std::string> includes;
- this->CurrentLocalGenerator->GetIncludeDirectories(includes);
+ this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target);
std::set<cmStdString> emitted;
emitted.insert("/System/Library/Frameworks");
for(std::vector<std::string>::iterator i = includes.begin();
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index 3b35d55..cbe344f 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -58,13 +58,21 @@ public:
{
return
" include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n"
- "Add the given directories to those searched by the compiler for "
- "include files. By default the directories are appended onto "
- "the current list of directories. This default behavior can be "
- "changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
- "By using BEFORE or AFTER you can select between appending and "
- "prepending, independent from the default. "
- "If the SYSTEM option is given the compiler will be told that the "
+ "Add the given directories to those the compiler uses to search "
+ "for include files. "
+ "These directories are added to the directory property "
+ "INCLUDE_DIRECTORIES for the current CMakeLists file. "
+ "They are also added to the target property INCLUDE_DIRECTORIES "
+ "for each target in the current CMakeLists file. "
+ "The target property values are the ones used by the generators."
+ "\n"
+ "By default the directories are appended onto the current list of "
+ "directories. "
+ "This default behavior can be changed by setting "
+ "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
+ "By using AFTER or BEFORE explicitly, you can select between "
+ "appending and prepending, independent of the default. "
+ "If the SYSTEM option is given, the compiler will be told the "
"directories are meant as system include directories on some "
"platforms.";
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1cfefed..aa3286c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -556,7 +556,7 @@ void cmLocalGenerator::GenerateTargetManifest()
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
cmSourceFile& source,
- cmTarget& )
+ cmTarget& target)
{
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
@@ -574,7 +574,11 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
std::string flags;
flags += this->Makefile->GetSafeDefinition(varString.c_str());
flags += " ";
- flags += this->GetIncludeFlags(lang);
+ {
+ std::vector<std::string> includes;
+ this->GetIncludeDirectories(includes, &target, lang);
+ flags += this->GetIncludeFlags(includes, lang);
+ }
flags += this->Makefile->GetDefineFlags();
// Construct the command lines.
@@ -1192,24 +1196,16 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
}
//----------------------------------------------------------------------------
-const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
- bool forResponseFile)
+std::string cmLocalGenerator::GetIncludeFlags(
+ const std::vector<std::string> &includes,
+ const char* lang, bool forResponseFile)
{
if(!lang)
{
return "";
}
- std::string key = lang;
- key += forResponseFile? "@" : "";
- if(this->LanguageToIncludeFlags.count(key))
- {
- return this->LanguageToIncludeFlags[key].c_str();
- }
cmOStringStream includeFlags;
- std::vector<std::string> includes;
- this->GetIncludeDirectories(includes, lang);
- std::vector<std::string>::iterator i;
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
@@ -1251,6 +1247,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
#ifdef __APPLE__
emitted.insert("/System/Library/Frameworks");
#endif
+ std::vector<std::string>::const_iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
if(this->Makefile->IsOn("APPLE")
@@ -1311,16 +1308,12 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
{
flags[flags.size()-1] = ' ';
}
- this->LanguageToIncludeFlags[key] = flags;
-
- // Use this temorary variable for the return value to work-around a
- // bogus GCC 2.95 warning.
- const char* ret = this->LanguageToIncludeFlags[key].c_str();
- return ret;
+ return flags;
}
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
+ cmTarget* target,
const char* lang)
{
// Need to decide whether to automatically include the source and
@@ -1375,8 +1368,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// Store the automatic include paths.
if(includeBinaryDir)
{
- dirs.push_back(this->Makefile->GetStartOutputDirectory());
- emitted.insert(this->Makefile->GetStartOutputDirectory());
+ if(emitted.find(
+ this->Makefile->GetStartOutputDirectory()) == emitted.end())
+ {
+ dirs.push_back(this->Makefile->GetStartOutputDirectory());
+ emitted.insert(this->Makefile->GetStartOutputDirectory());
+ }
}
if(includeSourceDir)
{
@@ -1402,9 +1399,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
}
- // Get the project-specified include directories.
- std::vector<std::string>& includes =
- this->Makefile->GetIncludeDirectories();
+ // Get the target-specific include directories.
+ std::vector<std::string> includes;
+ if(target)
+ {
+ includes = target->GetIncludeDirectories();
+ }
// Support putting all the in-project include directories first if
// it is requested by the project.
@@ -1412,7 +1412,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
{
const char* topSourceDir = this->Makefile->GetHomeDirectory();
const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
- for(std::vector<std::string>::iterator i = includes.begin();
+ for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
// Emit this directory only if it is a subdirectory of the
@@ -1431,7 +1431,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Construct the final ordered include directory list.
- for(std::vector<std::string>::iterator i = includes.begin();
+ for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
if(emitted.insert(*i).second)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 0c5b9d0..77c8862 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -146,8 +146,8 @@ public:
///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const char* newFlags);
///! Get the include flags for the current makefile and language
- const char* GetIncludeFlags(const char* lang,
- bool forResponseFile = false);
+ std::string GetIncludeFlags(const std::vector<std::string> &includes,
+ const char* lang, bool forResponseFile = false);
/**
* Encode a list of preprocessor definitions for the compiler
@@ -195,6 +195,7 @@ public:
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs,
+ cmTarget* target,
const char* lang = "C");
/** Compute the language used to compile the given source file. */
@@ -392,7 +393,6 @@ protected:
std::vector<std::string> StartOutputDirectoryComponents;
cmLocalGenerator* Parent;
std::vector<cmLocalGenerator*> Children;
- std::map<cmStdString, cmStdString> LanguageToIncludeFlags;
std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<cmStdString> ObjectMaxPathViolations;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 70dcfd5..75226b5 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -452,28 +452,6 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
<< "\n";
}
- // Store the include search path for this directory.
- infoFileStream
- << "# The C and CXX include file search paths:\n";
- infoFileStream
- << "SET(CMAKE_C_INCLUDE_PATH\n";
- std::vector<std::string> includeDirs;
- this->GetIncludeDirectories(includeDirs);
- for(std::vector<std::string>::iterator i = includeDirs.begin();
- i != includeDirs.end(); ++i)
- {
- infoFileStream
- << " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n";
- }
- infoFileStream
- << " )\n";
- infoFileStream
- << "SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
- infoFileStream
- << "SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
- infoFileStream
- << "SET(CMAKE_ASM_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
-
// Store the include regular expressions for this directory.
infoFileStream
<< "\n"
@@ -562,6 +540,21 @@ cmLocalUnixMakefileGenerator3
space = " ";
}
+ // Warn about paths not supported by Make tools.
+ std::string::size_type pos = tgt.find_first_of("=");
+ if(pos != std::string::npos)
+ {
+ cmOStringStream m;
+ m <<
+ "Make rule for\n"
+ " " << tgt << "\n"
+ "has '=' on left hand side. "
+ "The make tool may not support this.";
+ cmListFileBacktrace bt;
+ this->GlobalGenerator->GetCMakeInstance()
+ ->IssueMessage(cmake::WARNING, m.str(), bt);
+ }
+
// Mark the rule as symbolic if requested.
if(symbolic)
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 1dfcbea..c846d6b 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -103,52 +103,9 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
}
}
- // Setup /I and /LIBPATH options for the resulting DSP file. VS 6
- // truncates long include paths so make it as short as possible if
- // the length threatens this problem.
- unsigned int maxIncludeLength = 3000;
- bool useShortPath = false;
- for(int j=0; j < 2; ++j)
- {
- std::vector<std::string> includes;
- this->GetIncludeDirectories(includes);
- std::vector<std::string>::iterator i;
- for(i = includes.begin(); i != includes.end(); ++i)
- {
- std::string tmp =
- this->ConvertToOptionallyRelativeOutputPath(i->c_str());
- if(useShortPath)
- {
- cmSystemTools::GetShortPath(tmp.c_str(), tmp);
- }
- this->IncludeOptions += " /I ";
-
- // quote if not already quoted
- if (tmp[0] != '"')
- {
- this->IncludeOptions += "\"";
- this->IncludeOptions += tmp;
- this->IncludeOptions += "\"";
- }
- else
- {
- this->IncludeOptions += tmp;
- }
- }
- if(j == 0 && this->IncludeOptions.size() > maxIncludeLength)
- {
- this->IncludeOptions = "";
- useShortPath = true;
- }
- else
- {
- break;
- }
- }
-
// Create the DSP or set of DSP's for libraries and executables
- cmTargets &tgts = this->Makefile->GetTargets();
+ cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
@@ -895,6 +852,61 @@ inline std::string removeQuotes(const std::string& s)
return s;
}
+
+std::string
+cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target)
+{
+ std::string includeOptions;
+
+ // Setup /I and /LIBPATH options for the resulting DSP file. VS 6
+ // truncates long include paths so make it as short as possible if
+ // the length threatens this problem.
+ unsigned int maxIncludeLength = 3000;
+ bool useShortPath = false;
+ for(int j=0; j < 2; ++j)
+ {
+ std::vector<std::string> includes;
+ this->GetIncludeDirectories(includes, &target);
+
+ std::vector<std::string>::iterator i;
+ for(i = includes.begin(); i != includes.end(); ++i)
+ {
+ std::string tmp =
+ this->ConvertToOptionallyRelativeOutputPath(i->c_str());
+ if(useShortPath)
+ {
+ cmSystemTools::GetShortPath(tmp.c_str(), tmp);
+ }
+ includeOptions += " /I ";
+
+ // quote if not already quoted
+ if (tmp[0] != '"')
+ {
+ includeOptions += "\"";
+ includeOptions += tmp;
+ includeOptions += "\"";
+ }
+ else
+ {
+ includeOptions += tmp;
+ }
+ }
+
+ if(j == 0 && includeOptions.size() > maxIncludeLength)
+ {
+ includeOptions = "";
+ useShortPath = true;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return includeOptions;
+}
+
+
// Code in blocks surrounded by a test for this definition is needed
// only for compatibility with user project's replacement DSP
// templates. The CMake templates no longer use them.
@@ -1132,6 +1144,9 @@ void cmLocalVisualStudio6Generator
}
#endif
+ // Get include options for this target.
+ std::string includeOptions = this->GetTargetIncludeOptions(target);
+
// Get extra linker options for this target type.
std::string extraLinkOptions;
std::string extraLinkOptionsDebug;
@@ -1510,7 +1525,7 @@ void cmLocalVisualStudio6Generator
optionsRelWithDebInfo.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
- this->IncludeOptions.c_str());
+ includeOptions.c_str());
cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG",
targetVersionFlag.c_str());
cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG",
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index 195d654..c9c5dd1 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -89,7 +89,7 @@ private:
void ComputeLinkOptions(cmTarget& target, const char* configName,
const std::string extraOptions,
std::string& options);
- std::string IncludeOptions;
+ std::string GetTargetIncludeOptions(cmTarget &target);
std::vector<std::string> Configurations;
std::string GetConfigName(std::string const& configuration) const;
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 11a0387..1743517 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -807,7 +807,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string> includes;
- this->GetIncludeDirectories(includes);
+ this->GetIncludeDirectories(includes, &target);
std::vector<std::string>::iterator i = includes.begin();
for(;i != includes.end(); ++i)
{
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 774f32b..f81a63d 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -23,6 +23,17 @@ public:
~cmMacroHelperCommand() {};
/**
+ * This is used to avoid including this command
+ * in documentation. This is mainly used by
+ * cmMacroHelperCommand and cmFunctionHelperCommand
+ * which cannot provide appropriate documentation.
+ */
+ virtual bool ShouldAppearInDocumentation()
+ {
+ return false;
+ }
+
+ /**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 0b4eea5..6055c55 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -54,16 +54,33 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
this->Makefile->IncludeFileRegularExpression.c_str());
this->ComplainFileRegularExpression.compile(
this->Makefile->ComplainFileRegularExpression.c_str());
-
- // Now extract any include paths from the makefile flags
- const std::vector<std::string>& includes =
- this->Makefile->GetIncludeDirectories();
- for(std::vector<std::string>::const_iterator j = includes.begin();
- j != includes.end(); ++j)
+
+ // Now extract any include paths from the targets
+ std::set<std::string> uniqueIncludes;
+ std::vector<std::string> orderedAndUniqueIncludes;
+ cmTargets & targets = this->Makefile->GetTargets();
+ for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
+ {
+ const std::vector<std::string>& includes =
+ l->second.GetIncludeDirectories();
+ for(std::vector<std::string>::const_iterator j = includes.begin();
+ j != includes.end(); ++j)
+ {
+ std::string path = *j;
+ this->Makefile->ExpandVariablesInString(path);
+ if(uniqueIncludes.insert(path).second)
+ {
+ orderedAndUniqueIncludes.push_back(path);
+ }
+ }
+ }
+
+ for(std::vector<std::string>::const_iterator
+ it = orderedAndUniqueIncludes.begin();
+ it != orderedAndUniqueIncludes.end();
+ ++it)
{
- std::string path = *j;
- this->Makefile->ExpandVariablesInString(path);
- this->AddSearchPath(path.c_str());
+ this->AddSearchPath(it->c_str());
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index fdf5b31..d206d32 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -116,7 +116,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
this->Targets = mf.Targets;
this->SourceFiles = mf.SourceFiles;
this->Tests = mf.Tests;
- this->IncludeDirectories = mf.IncludeDirectories;
this->LinkDirectories = mf.LinkDirectories;
this->SystemIncludeDirectories = mf.SystemIncludeDirectories;
this->ListFiles = mf.ListFiles;
@@ -278,8 +277,6 @@ void cmMakefile::Print()
this->cmHomeDirectory.c_str() << std::endl;
std::cout << " this->ProjectName; "
<< this->ProjectName.c_str() << std::endl;
- this->PrintStringVector("this->IncludeDirectories;",
- this->IncludeDirectories);
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
#if defined(CMAKE_BUILD_WITH_CMAKE)
for( std::vector<cmSourceGroup>::const_iterator i =
@@ -1478,7 +1475,8 @@ void cmMakefile::InitializeFromParent()
this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure();
// copy include paths
- this->IncludeDirectories = parent->IncludeDirectories;
+ this->SetProperty("INCLUDE_DIRECTORIES",
+ parent->GetProperty("INCLUDE_DIRECTORIES"));
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
// define flags
@@ -1603,42 +1601,61 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
}
}
-void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
+//----------------------------------------------------------------------------
+void AddStringToProperty(cmProperty *prop, const char* name, const char* s,
+ bool before)
{
- // if there is a newline then break it into multiple arguments
- if (!inc)
+ if (!prop)
{
return;
}
- // Don't add an include directory that is already present. Yes,
- // this linear search results in n^2 behavior, but n won't be
- // getting much bigger than 20. We cannot use a set because of
- // order dependency of the include path.
- std::vector<std::string>::iterator i =
- std::find(this->IncludeDirectories.begin(),
- this->IncludeDirectories.end(), inc);
- if(i == this->IncludeDirectories.end())
+ // Don't worry about duplicates at this point. We eliminate them when
+ // we convert the property to a vector in GetIncludeDirectories.
+
+ if (before)
{
- if (before)
+ const char *val = prop->GetValue();
+ cmOStringStream oss;
+
+ if(val && *val)
{
- // WARNING: this *is* expensive (linear time) since it's a vector
- this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc);
+ oss << s << ";" << val;
}
else
{
- this->IncludeDirectories.push_back(inc);
+ oss << s;
}
+
+ std::string newVal = oss.str();
+ prop->Set(name, newVal.c_str());
}
else
{
- if(before)
- {
- // if this before and already in the path then remove it
- this->IncludeDirectories.erase(i);
- // WARNING: this *is* expensive (linear time) since it's a vector
- this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc);
- }
+ prop->Append(name, s);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
+{
+ if (!inc)
+ {
+ return;
+ }
+
+ // Directory property:
+ cmProperty *prop =
+ this->GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES");
+ AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before);
+
+ // Property on each target:
+ for (cmTargets::iterator l = this->Targets.begin();
+ l != this->Targets.end(); ++l)
+ {
+ cmTarget &t = l->second;
+ prop = t.GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES");
+ AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before);
}
}
@@ -2093,17 +2110,37 @@ void cmMakefile::AddExtraDirectory(const char* dir)
}
-// expance CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
+// expand CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
// include and library directories.
void cmMakefile::ExpandVariables()
{
// Now expand variables in the include and link strings
- for(std::vector<std::string>::iterator d = this->IncludeDirectories.begin();
- d != this->IncludeDirectories.end(); ++d)
+
+ // May not be necessary anymore... But may need a policy for strict
+ // backwards compatibility
+ const char *includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
+ if (includeDirs)
{
- this->ExpandVariablesInString(*d, true, true);
+ std::string dirs = includeDirs;
+ this->ExpandVariablesInString(dirs, true, true);
+ this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ }
+
+ // Also for each target's INCLUDE_DIRECTORIES property:
+ for (cmTargets::iterator l = this->Targets.begin();
+ l != this->Targets.end(); ++l)
+ {
+ cmTarget &t = l->second;
+ const char *includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
+ if (includeDirs)
+ {
+ std::string dirs = includeDirs;
+ this->ExpandVariablesInString(dirs, true, true);
+ t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
+ }
}
+
for(std::vector<std::string>::iterator d = this->LinkDirectories.begin();
d != this->LinkDirectories.end(); ++d)
{
@@ -3317,16 +3354,6 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
// handle special props
std::string propname = prop;
- if ( propname == "INCLUDE_DIRECTORIES" )
- {
- std::vector<std::string> varArgsExpanded;
- if(value)
- {
- cmSystemTools::ExpandListArgument(value, varArgsExpanded);
- }
- this->SetIncludeDirectories(varArgsExpanded);
- return;
- }
if ( propname == "LINK_DIRECTORIES" )
{
@@ -3368,17 +3395,6 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
// handle special props
std::string propname = prop;
- if ( propname == "INCLUDE_DIRECTORIES" )
- {
- std::vector<std::string> varArgsExpanded;
- cmSystemTools::ExpandListArgument(value, varArgsExpanded);
- for(std::vector<std::string>::const_iterator vi = varArgsExpanded.begin();
- vi != varArgsExpanded.end(); ++vi)
- {
- this->AddIncludeDirectory(vi->c_str());
- }
- return;
- }
if ( propname == "LINK_DIRECTORIES" )
{
@@ -3474,23 +3490,6 @@ const char *cmMakefile::GetProperty(const char* prop,
output += this->DefineFlagsOrig;
return output.c_str();
}
- else if (!strcmp("INCLUDE_DIRECTORIES",prop) )
- {
- cmOStringStream str;
- for (std::vector<std::string>::const_iterator
- it = this->GetIncludeDirectories().begin();
- it != this->GetIncludeDirectories().end();
- ++ it )
- {
- if ( it != this->GetIncludeDirectories().begin())
- {
- str << ";";
- }
- str << it->c_str();
- }
- output = str.str();
- return output.c_str();
- }
else if (!strcmp("LINK_DIRECTORIES",prop))
{
cmOStringStream str;
@@ -3861,9 +3860,22 @@ void cmMakefile::DefineProperties(cmake *cm)
cm->DefineProperty
("INCLUDE_DIRECTORIES", cmProperty::DIRECTORY,
"List of preprocessor include file search directories.",
- "This read-only property specifies the list of directories given "
- "so far to the include_directories command. "
- "It is intended for debugging purposes.", false);
+ "This property specifies the list of directories given "
+ "so far to the include_directories command. "
+ "This property exists on directories and targets. "
+ "In addition to accepting values from the include_directories "
+ "command, values may be set directly on any directory or any "
+ "target using the set_property command. "
+ "A target gets its initial value for this property from the value "
+ "of the directory property. "
+ "A directory gets its initial value from its parent directory if "
+ "it has one. "
+ "Both directory and target property values are adjusted by calls "
+ "to the include_directories command."
+ "\n"
+ "The target property values are used by the generators to set "
+ "the include paths for the compiler. "
+ "See also the include_directories command.");
cm->DefineProperty
("LINK_DIRECTORIES", cmProperty::DIRECTORY,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1c46a73..c2939fb 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -522,22 +522,6 @@ public:
cmTarget* FindTargetToUse(const char* name);
/**
- * Get a list of include directories in the build.
- */
- std::vector<std::string>& GetIncludeDirectories()
- {
- return this->IncludeDirectories;
- }
- const std::vector<std::string>& GetIncludeDirectories() const
- {
- return this->IncludeDirectories;
- }
- void SetIncludeDirectories(const std::vector<std::string>& vec)
- {
- this->IncludeDirectories = vec;
- }
-
- /**
* Mark include directories as system directories.
*/
void AddSystemIncludeDirectory(const char* dir);
@@ -880,9 +864,7 @@ protected:
// Tests
std::map<cmStdString, cmTest*> Tests;
- // The include and link-library paths. These may have order
- // dependency, so they must be vectors (not set).
- std::vector<std::string> IncludeDirectories;
+ // The link-library paths. Order matters, use std::vector (not std::set).
std::vector<std::string> LinkDirectories;
// The set of include directories that are marked as system include
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a3a832b..e5be4aa 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1069,6 +1069,35 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
}
+ // Target-specific include directories:
+ *this->InfoFileStream
+ << "\n"
+ << "# The include file search paths:\n";
+ *this->InfoFileStream
+ << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
+ std::vector<std::string> includes;
+ this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
+ for(std::vector<std::string>::iterator i = includes.begin();
+ i != includes.end(); ++i)
+ {
+ *this->InfoFileStream
+ << " \""
+ << this->LocalGenerator->Convert(i->c_str(),
+ cmLocalGenerator::HOME_OUTPUT)
+ << "\"\n";
+ }
+ *this->InfoFileStream
+ << " )\n";
+ *this->InfoFileStream
+ << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH "
+ << "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
+ *this->InfoFileStream
+ << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH "
+ << "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
+ *this->InfoFileStream
+ << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH "
+ << "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
+
// and now write the rule to use it
std::vector<std::string> depends;
std::vector<std::string> commands;
@@ -1534,7 +1563,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags()
emitted.insert("/System/Library/Frameworks");
#endif
std::vector<std::string> includes;
- this->LocalGenerator->GetIncludeDirectories(includes);
+ this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
std::vector<std::string>::iterator i;
// check all include directories for frameworks as this
// will already have added a -F for the framework
@@ -1829,8 +1858,12 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES";
bool useResponseFile = this->Makefile->IsOn(responseVar.c_str());
+
+ std::vector<std::string> includes;
+ this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang);
+
std::string includeFlags =
- this->LocalGenerator->GetIncludeFlags(lang, useResponseFile);
+ this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
if(includeFlags.empty())
{
return;
@@ -1930,7 +1963,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
{
std::vector<std::string> includes;
- this->LocalGenerator->GetIncludeDirectories(includes);
+ this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
for(std::vector<std::string>::const_iterator idi = includes.begin();
idi != includes.end(); ++idi)
{
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3e927cf..1376a48 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -131,6 +131,8 @@ void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*);
void* cmSystemTools::s_ErrorCallbackClientData = 0;
void* cmSystemTools::s_StdoutCallbackClientData = 0;
+bool (*cmSystemTools::s_InterruptCallback)(void*);
+void* cmSystemTools::s_InterruptCallbackClientData = 0;
// replace replace with with as many times as it shows up in source.
// write the result into source.
@@ -234,6 +236,20 @@ void cmSystemTools::Error(const char* m1, const char* m2,
cmSystemTools::Message(message.c_str(),"Error");
}
+void cmSystemTools::SetInterruptCallback(InterruptCallback f, void* clientData)
+{
+ s_InterruptCallback = f;
+ s_InterruptCallbackClientData = clientData;
+}
+
+bool cmSystemTools::GetInterruptFlag()
+{
+ if(s_InterruptCallback)
+ {
+ return (*s_InterruptCallback)(s_InterruptCallbackClientData);
+ }
+ return false;
+}
void cmSystemTools::SetErrorCallback(ErrorCallback f, void* clientData)
{
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 88ae1c0..5f21de2 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -83,6 +83,11 @@ public:
///! Send a string to stderr. Stdout callbacks will not be invoced.
static void Stderr(const char* s, int length);
+
+ typedef bool (*InterruptCallback)(void*);
+ static void SetInterruptCallback(InterruptCallback f, void* clientData=0);
+ static bool GetInterruptFlag();
+
///! Return true if there was an error at any point.
static bool GetErrorOccuredFlag()
{
@@ -101,7 +106,7 @@ public:
///! Return true if there was an error at any point.
static bool GetFatalErrorOccured()
{
- return cmSystemTools::s_FatalErrorOccured;
+ return cmSystemTools::s_FatalErrorOccured || GetInterruptFlag();
}
///! Set the error occured flag and fatal error back to false
@@ -472,8 +477,10 @@ private:
static bool s_DisableRunCommandOutput;
static ErrorCallback s_ErrorCallback;
static StdoutCallback s_StdoutCallback;
+ static InterruptCallback s_InterruptCallback;
static void* s_ErrorCallbackClientData;
static void* s_StdoutCallbackClientData;
+ static void* s_InterruptCallbackClientData;
static std::string s_Windows9xComspecSubstitute;
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1a68cee..e618bee 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -486,6 +486,26 @@ void cmTarget::DefineProperties(cmake *cm)
"undefined behavior.");
cm->DefineProperty
+ ("INCLUDE_DIRECTORIES", cmProperty::TARGET,
+ "List of preprocessor include file search directories.",
+ "This property specifies the list of directories given "
+ "so far to the include_directories command. "
+ "This property exists on directories and targets. "
+ "In addition to accepting values from the include_directories "
+ "command, values may be set directly on any directory or any "
+ "target using the set_property command. "
+ "A target gets its initial value for this property from the value "
+ "of the directory property. "
+ "A directory gets its initial value from its parent directory if "
+ "it has one. "
+ "Both directory and target property values are adjusted by calls "
+ "to the include_directories command."
+ "\n"
+ "The target property values are used by the generators to set "
+ "the include paths for the compiler. "
+ "See also the include_directories command.");
+
+ cm->DefineProperty
("INSTALL_NAME_DIR", cmProperty::TARGET,
"Mac OSX directory name for installed targets.",
"INSTALL_NAME_DIR is a string specifying the "
@@ -1047,10 +1067,10 @@ void cmTarget::DefineProperties(cmake *cm)
"Can be set to one or more UUIDs recognized by Visual Studio "
"to indicate the type of project. This value is copied "
"verbatim into the generated project file. Example for a "
- "managed C++ unit testing project: \""
- "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
- "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are "
- "semicolon-delimited.");
+ "managed C++ unit testing project:\n"
+ " {3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
+ "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\n"
+ "UUIDs are semicolon-delimited.");
cm->DefineProperty
("VS_GLOBAL_KEYWORD", cmProperty::TARGET,
"Visual Studio project keyword.",
@@ -1065,6 +1085,16 @@ void cmTarget::DefineProperties(cmake *cm)
"generated Visual Studio project. For example, \"System;"
"System.Windows.Forms\".");
cm->DefineProperty
+ ("VS_WINRT_EXTENSIONS", cmProperty::TARGET,
+ "Visual Studio project C++/CX language extensions for Windows Runtime",
+ "Can be set to enable C++/CX language extensions.");
+ cm->DefineProperty
+ ("VS_WINRT_REFERENCES", cmProperty::TARGET,
+ "Visual Studio project Windows Runtime Metadata references",
+ "Adds one or more semicolon-delimited WinRT references to a "
+ "generated Visual Studio project. For example, \"Windows;"
+ "Windows.UI.Core\".");
+ cm->DefineProperty
("VS_GLOBAL_<variable>", cmProperty::TARGET,
"Visual Studio project-specific global variable.",
"Tell the Visual Studio generator to set the global variable "
@@ -1269,6 +1299,11 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Save the backtrace of target construction.
this->Makefile->GetBacktrace(this->Internal->Backtrace);
+ // Initialize the INCLUDE_DIRECTORIES property based on the current value
+ // of the same directory property:
+ this->SetProperty("INCLUDE_DIRECTORIES",
+ this->Makefile->GetProperty("INCLUDE_DIRECTORIES"));
+
// Record current policies for later use.
this->PolicyStatusCMP0003 =
this->Makefile->GetPolicyStatus(cmPolicies::CMP0003);
@@ -4666,6 +4701,30 @@ cmTarget::GetLinkInformation(const char* config)
}
//----------------------------------------------------------------------------
+std::vector<std::string> cmTarget::GetIncludeDirectories()
+{
+ std::vector<std::string> includes;
+ const char *prop = this->GetProperty("INCLUDE_DIRECTORIES");
+ if(prop)
+ {
+ cmSystemTools::ExpandListArgument(prop, includes);
+ }
+
+ std::set<std::string> uniqueIncludes;
+ std::vector<std::string> orderedAndUniqueIncludes;
+ for(std::vector<std::string>::const_iterator
+ li = includes.begin(); li != includes.end(); ++li)
+ {
+ if(uniqueIncludes.insert(*li).second)
+ {
+ orderedAndUniqueIncludes.push_back(*li);
+ }
+ }
+
+ return orderedAndUniqueIncludes;
+}
+
+//----------------------------------------------------------------------------
cmTargetLinkInformationMap
::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived()
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 59f0184..dfed499 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -458,6 +458,9 @@ public:
directory. */
bool UsesDefaultOutputDir(const char* config, bool implib);
+ /** Get the include directories for this target. */
+ std::vector<std::string> GetIncludeDirectories();
+
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 449adc1..f9148a1 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -255,6 +255,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteObjSources();
this->WriteCLSources();
this->WriteDotNetReferences();
+ this->WriteWinRTReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -268,33 +269,49 @@ void cmVisualStudio10TargetGenerator::Generate()
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
{
- const char* vsDotNetReferences
- = this->Target->GetProperty("VS_DOTNET_REFERENCES");
- if(vsDotNetReferences)
+ std::vector<std::string> references;
+ if(const char* vsDotNetReferences =
+ this->Target->GetProperty("VS_DOTNET_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
+ }
+ if(!references.empty())
{
- std::string references(vsDotNetReferences);
- std::string::size_type position = 0;
-
this->WriteString("<ItemGroup>\n", 1);
- while(references.length() > 0)
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
{
- if((position = references.find(";")) == std::string::npos)
- {
- position = references.length() + 1;
- }
-
this->WriteString("<Reference Include=\"", 2);
- (*this->BuildFileStream) <<
- cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
this->WriteString("<CopyLocalSatelliteAssemblies>true"
"</CopyLocalSatelliteAssemblies>\n", 3);
this->WriteString("<ReferenceOutputAssembly>true"
"</ReferenceOutputAssembly>\n", 3);
this->WriteString("</Reference>\n", 2);
-
- references.erase(0, position + 1);
}
+ this->WriteString("</ItemGroup>\n", 1);
+ }
+}
+void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
+{
+ std::vector<std::string> references;
+ if(const char* vsWinRTReferences =
+ this->Target->GetProperty("VS_WINRT_REFERENCES"))
+ {
+ cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
+ }
+ if(!references.empty())
+ {
+ this->WriteString("<ItemGroup>\n", 1);
+ for(std::vector<std::string>::iterator ri = references.begin();
+ ri != references.end(); ++ri)
+ {
+ this->WriteString("<Reference Include=\"", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
+ this->WriteString("<IsWinMDFile>true</IsWinMDFile>\n", 3);
+ this->WriteString("</Reference>\n", 2);
+ }
this->WriteString("</ItemGroup>\n", 1);
}
}
@@ -372,7 +389,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
this->WriteString(mfcLine.c_str(), 2);
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
- this->ClOptions[*i]->UsingUnicode())
+ this->ClOptions[*i]->UsingUnicode() ||
+ this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -387,6 +405,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<Immersive>true</Immersive>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
}
@@ -1564,7 +1586,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
std::vector<std::string> includes;
- this->LocalGenerator->GetIncludeDirectories(includes);
+ this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
{
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 6702509..90035f2 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -48,6 +48,7 @@ private:
void WriteProjectConfigurationValues();
void WriteCLSources();
void WriteDotNetReferences();
+ void WriteWinRTReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 7eafda2..4000345 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -25,7 +25,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile"))
{
// if this is the endwhile for this while loop then execute
- if (!this->Depth)
+ if (!this->Depth)
{
// Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker>
@@ -33,16 +33,16 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
if(!fb.get()) { return false; }
std::string errorString;
-
+
std::vector<std::string> expandedArguments;
mf.ExpandArguments(this->Args, expandedArguments);
cmake::MessageType messageType;
- bool isTrue =
+ bool isTrue =
cmIfCommand::IsTrue(expandedArguments,errorString,
&mf, messageType);
while (isTrue)
- {
+ {
if (errorString.size())
{
std::string err = "had incorrect arguments: ";
@@ -86,7 +86,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
}
expandedArguments.clear();
mf.ExpandArguments(this->Args, expandedArguments);
- isTrue =
+ isTrue =
cmIfCommand::IsTrue(expandedArguments,errorString,
&mf, messageType);
}
@@ -101,7 +101,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
// record the command
this->Functions.push_back(lff);
-
+
// always return true
return true;
}
@@ -123,7 +123,7 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& )
}
bool cmWhileCommand
-::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
cmExecutionStatus &)
{
if(args.size() < 1)
@@ -131,12 +131,12 @@ bool cmWhileCommand
this->SetError("called with incorrect number of arguments");
return false;
}
-
+
// create a function blocker
cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker();
f->Args = args;
this->Makefile->AddFunctionBlocker(f);
-
+
return true;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1d793d7..c5e6d44 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -602,14 +602,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
std::vector<std::string> includeDirs;
cmSystemTools::ExpandListArgument(includes, includeDirs);
- for(std::vector<std::string>::const_iterator dirIt=includeDirs.begin();
- dirIt != includeDirs.end();
- ++dirIt)
- {
- mf->AddIncludeDirectory(dirIt->c_str(), false);
- }
- std::string includeFlags = lg->GetIncludeFlags(language.c_str(), false);
+ std::string includeFlags = lg->GetIncludeFlags(includeDirs,
+ language.c_str(), false);
+
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
}
@@ -2130,32 +2126,8 @@ int cmake::Configure()
}
-bool cmake::RejectUnsupportedPaths(const char* desc, std::string const& path)
-{
- // Some characters are not well-supported by native build systems.
- std::string::size_type pos = path.find_first_of("=");
- if(pos == std::string::npos)
- {
- return false;
- }
- cmOStringStream e;
- e << "The path to the " << desc << " directory:\n"
- << " " << path << "\n"
- << "contains unsupported character '" << path[pos] << "'.\n"
- << "Please use a different " << desc << " directory name.";
- cmListFileBacktrace bt;
- this->IssueMessage(cmake::FATAL_ERROR, e.str(), bt);
- return true;
-}
-
int cmake::ActualConfigure()
{
- if(this->RejectUnsupportedPaths("source", this->cmHomeDirectory) ||
- this->RejectUnsupportedPaths("binary", this->HomeOutputDirectory))
- {
- return 1;
- }
-
// Construct right now our path conversion table before it's too late:
this->UpdateConversionPathTable();
this->CleanupCommandsAndMacros();
@@ -2208,8 +2180,11 @@ int cmake::ActualConfigure()
std::string installedCompiler;
// Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
- std::string vsregBase =
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
+ const std::string vsregBase =
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\";
+ std::vector<std::string> vsVerions;
+ vsVerions.push_back("VisualStudio\\");
+ vsVerions.push_back("VCExpress\\");
struct VSRegistryEntryName
{
const char* MSVersion;
@@ -2223,14 +2198,18 @@ int cmake::ActualConfigure()
{"9.0", "Visual Studio 9 2008"},
{"10.0", "Visual Studio 10"},
{0, 0}};
- for(int i =0; version[i].MSVersion != 0; i++)
+ for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++)
{
- std::string reg = vsregBase + version[i].MSVersion;
- reg += ";InstallDir]";
- cmSystemTools::ExpandRegistryValues(reg);
- if (!(reg == "/registry"))
+ for(int i =0; version[i].MSVersion != 0; i++)
{
- installedCompiler = version[i].GeneratorName;
+ std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion;
+ reg += ";InstallDir]";
+ cmSystemTools::ExpandRegistryValues(reg,
+ cmSystemTools::KeyWOW64_32);
+ if (!(reg == "/registry"))
+ {
+ installedCompiler = version[i].GeneratorName;
+ }
}
}
cmGlobalGenerator* gen
@@ -2685,7 +2664,9 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
j != this->Commands.end(); ++j)
{
if ((( withCompatCommands == false) && ( (*j).second->IsDiscouraged()))
- || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged())))
+ || ((withCurrentCommands == false) && (!(*j).second->IsDiscouraged()))
+ || (!((*j).second->ShouldAppearInDocumentation()))
+ )
{
continue;
}
diff --git a/Source/cmake.h b/Source/cmake.h
index ae56e85..31b1bb7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -468,8 +468,6 @@ protected:
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
std::string FindCMakeProgram(const char* name) const;
-
- bool RejectUnsupportedPaths(const char* desc, std::string const& path);
private:
cmake(const cmake&); // Not implemented.
void operator=(const cmake&); // Not implemented.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 436236d..c3de8ca 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -355,6 +355,7 @@ int do_cmake(int ac, char** av)
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDocumentation doc;
+ doc.addCMakeStandardDocSections();
if(doc.CheckOptions(ac, av, "-E") || nocwd)
{
// Construct and print requested documentation.
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 85cecea..d41627e 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -291,6 +291,7 @@ int main (int argc, char *argv[])
<< "*********************************" << std::endl);
}
cmDocumentation doc;
+ doc.addCTestStandardDocSections();
if(doc.CheckOptions(argc, argv) || nocwd)
{
// Construct and print requested documentation.
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 664bf6f..baf15ad 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012)
SET(KWSYS_DATE_STAMP_MONTH 02)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 02)
+SET(KWSYS_DATE_STAMP_DAY 22)