summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackGenerator.h7
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx7
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.h7
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx14
-rw-r--r--Source/CTest/cmCTestTestHandler.h13
-rw-r--r--Source/cmAddCustomCommandCommand.h4
-rw-r--r--Source/cmAddExecutableCommand.cxx3
-rw-r--r--Source/cmAddLibraryCommand.cxx33
-rw-r--r--Source/cmBuildCommand.h4
-rw-r--r--Source/cmBuildNameCommand.h4
-rw-r--r--Source/cmCMakeMinimumRequired.h4
-rw-r--r--Source/cmCacheManager.cxx12
-rw-r--r--Source/cmCacheManager.h6
-rw-r--r--Source/cmComputeLinkInformation.cxx12
-rw-r--r--Source/cmComputeTargetDepends.cxx8
-rw-r--r--Source/cmDocumentVariables.cxx25
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx61
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx10
-rw-r--r--Source/cmFindPackageCommand.cxx41
-rw-r--r--Source/cmGlobalGenerator.cxx68
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx36
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio10IA64Generator.cxx51
-rw-r--r--Source/cmGlobalVisualStudio10IA64Generator.h40
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.cxx36
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio9IA64Generator.cxx48
-rw-r--r--Source/cmGlobalVisualStudio9IA64Generator.h50
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx67
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx7
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h10
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx16
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx81
-rw-r--r--Source/cmLocalVisualStudio7Generator.h6
-rw-r--r--Source/cmMakefile.cxx12
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmMarkAsAdvancedCommand.h4
-rw-r--r--Source/cmProperty.cxx4
-rw-r--r--Source/cmProperty.h2
-rw-r--r--Source/cmPropertyMap.cxx4
-rw-r--r--Source/cmPropertyMap.h2
-rw-r--r--Source/cmQtAutomoc.cxx782
-rw-r--r--Source/cmQtAutomoc.h66
-rw-r--r--Source/cmRemoveCommand.h4
-rw-r--r--Source/cmSeparateArgumentsCommand.h4
-rw-r--r--Source/cmSetPropertyCommand.cxx20
-rw-r--r--Source/cmSetPropertyCommand.h6
-rw-r--r--Source/cmSetTargetPropertiesCommand.h4
-rw-r--r--Source/cmSiteNameCommand.cxx2
-rw-r--r--Source/cmSiteNameCommand.h4
-rw-r--r--Source/cmSourceFile.cxx6
-rw-r--r--Source/cmSourceFile.h2
-rw-r--r--Source/cmSystemTools.cxx236
-rw-r--r--Source/cmSystemTools.h95
-rw-r--r--Source/cmTarget.cxx52
-rw-r--r--Source/cmTarget.h8
-rw-r--r--Source/cmTest.cxx4
-rw-r--r--Source/cmTest.h2
-rw-r--r--Source/cmTryCompileCommand.h9
-rw-r--r--Source/cmTryRunCommand.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx28
-rw-r--r--Source/cmXCodeObject.cxx2
-rw-r--r--Source/cmake.cxx33
-rw-r--r--Source/cmake.h6
-rw-r--r--Source/cmakemain.cxx8
-rw-r--r--Source/kwsys/SystemTools.cxx75
-rw-r--r--Source/kwsys/SystemTools.hxx.in8
-rw-r--r--Source/kwsys/hash_fun.hxx.in24
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
76 files changed, 1863 insertions, 502 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ca063d5..96b3ea0 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -228,6 +228,8 @@ SET(SRCS
cmPropertyDefinitionMap.h
cmPropertyMap.cxx
cmPropertyMap.h
+ cmQtAutomoc.cxx
+ cmQtAutomoc.h
cmScriptGenerator.h
cmScriptGenerator.cxx
cmSourceFile.cxx
@@ -308,6 +310,8 @@ IF (WIN32)
cmGlobalVisualStudio8Win64Generator.h
cmGlobalVisualStudio9Win64Generator.cxx
cmGlobalVisualStudio9Win64Generator.h
+ cmGlobalVisualStudio9IA64Generator.cxx
+ cmGlobalVisualStudio9IA64Generator.h
cmVisualStudioGeneratorOptions.h
cmVisualStudioGeneratorOptions.cxx
cmVisualStudio10TargetGenerator.h
@@ -318,6 +322,8 @@ IF (WIN32)
cmGlobalVisualStudio10Generator.cxx
cmGlobalVisualStudio10Win64Generator.h
cmGlobalVisualStudio10Win64Generator.cxx
+ cmGlobalVisualStudio10IA64Generator.h
+ cmGlobalVisualStudio10IA64Generator.cxx
cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7e5b26d..0e4acd5 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -33,7 +33,7 @@
//----------------------------------------------------------------------
cmCPackGenerator::cmCPackGenerator()
{
- this->GeneratorVerbose = false;
+ this->GeneratorVerbose = cmSystemTools::OUTPUT_NONE;
this->MakefileMap = 0;
this->Logger = 0;
this->componentPackageMethod = ONE_PACKAGE_PER_GROUP;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 05d95b8..52def9d 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -14,6 +14,7 @@
#define cmCPackGenerator_h
#include "cmObject.h"
+#include "cmSystemTools.h"
#include <map>
#include <vector>
@@ -57,7 +58,9 @@ public:
/**
* If verbose then more information is printed out
*/
- void SetVerbose(bool val) { this->GeneratorVerbose = val; }
+ void SetVerbose(bool val)
+ { this->GeneratorVerbose = val ?
+ cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
/**
* Do the actual whole package processing.
@@ -194,7 +197,7 @@ protected:
virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName,
const char* name);
- bool GeneratorVerbose;
+ cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
std::string InstallPath;
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index e5fe575..2b94067 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -672,9 +672,6 @@ CreateComponentDescription(cmCPackComponent *component,
}
componentCode += " SetOutPath \"$INSTDIR\"\n";
- componentCode += " IntCmp $" + component->Name
- + "_was_installed ${SF_SELECTED} noinstall_" + component->Name + "\n";
-
// Create the actual installation commands
if (component->IsDownloaded)
{
@@ -786,7 +783,8 @@ CreateComponentDescription(cmCPackComponent *component,
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &retVal,
- dirName.c_str(), false, 0);
+ dirName.c_str(),
+ cmSystemTools::OUTPUT_NONE, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@@ -824,7 +822,6 @@ CreateComponentDescription(cmCPackComponent *component,
componentCode += " File /r \"${INST_DIR}\\" +
component->Name + "\\*.*\"\n";
}
- componentCode += " noinstall_" + component->Name + ":\n";
componentCode += "SectionEnd\n";
// Macro used to remove the component
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 8c3c22a..fd75e45 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -18,7 +18,7 @@
//----------------------------------------------------------------------
cmCTestGenericHandler::cmCTestGenericHandler()
{
- this->HandlerVerbose = false;
+ this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
this->CTest = 0;
this->SubmitIndex = 0;
this->AppendXML = false;
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index 7393145..18189ec 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -16,6 +16,7 @@
#include "cmObject.h"
#include "cmCTest.h"
+#include "cmSystemTools.h" //OutputOption
class cmMakefile;
class cmCTestCommand;
@@ -31,7 +32,9 @@ public:
/**
* If verbose then more informaiton is printed out
*/
- void SetVerbose(bool val) { this->HandlerVerbose = val; }
+ void SetVerbose(bool val)
+ { this->HandlerVerbose = val ?
+ cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
/**
* Populate internals from CTest custom scripts
@@ -91,7 +94,7 @@ protected:
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool AppendXML;
- bool HandlerVerbose;
+ cmSystemTools::OutputOption HandlerVerbose;
cmCTest *CTest;
t_StringToString Options;
t_StringToString PersistentOptions;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e3b81df..9b12393 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -33,6 +33,7 @@
#include <float.h>
#include <memory> // auto_ptr
+#include <set>
//----------------------------------------------------------------------
class cmCTestSubdirCommand : public cmCommand
@@ -617,9 +618,13 @@ int cmCTestTestHandler::ProcessHandler()
<< "The following tests FAILED:" << std::endl);
this->StartLogFile("TestsFailed", ofs);
- std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator ftit;
- for(ftit = this->TestResults.begin();
- ftit != this->TestResults.end(); ++ftit)
+ typedef std::set<cmCTestTestHandler::cmCTestTestResult,
+ cmCTestTestResultLess> SetOfTests;
+ SetOfTests resultsSet(this->TestResults.begin(),
+ this->TestResults.end());
+
+ for(SetOfTests::iterator ftit = resultsSet.begin();
+ ftit != resultsSet.end(); ++ftit)
{
if ( ftit->Status != cmCTestTestHandler::COMPLETED )
{
@@ -1301,7 +1306,8 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
int retVal = 0;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
<< std::endl);
- if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0, true
+ if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0,
+ cmSystemTools::OUTPUT_MERGE
/*this->Verbose*/) || retVal != 0 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem running command: "
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 3089d35..8e59e59 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -125,7 +125,16 @@ public:
cmCTestTestProperties* Properties;
};
- // add configuraitons to a search path for an executable
+ struct cmCTestTestResultLess
+ {
+ bool operator() (const cmCTestTestResult &lhs,
+ const cmCTestTestResult &rhs) const
+ {
+ return lhs.TestCount < rhs.TestCount;
+ }
+ };
+
+ // add configurations to a search path for an executable
static void AddConfigurations(cmCTest *ctest,
std::vector<std::string> &attempted,
std::vector<std::string> &attemptedConfigs,
@@ -141,7 +150,7 @@ public:
typedef std::vector<cmCTestTestProperties> ListOfTests;
protected:
- // comput a final test list
+ // compute a final test list
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args);
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 47b542c..05e7dc2 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -75,6 +75,10 @@ public:
"A target created in the same directory (CMakeLists.txt file) that "
"specifies any output of the custom command as a source file is given "
"a rule to generate the file using the command at build time. "
+ "Do not list the output in more than one independent target that may "
+ "build in parallel or the two instances of the rule may conflict "
+ "(instead use add_custom_target to drive the command and make the "
+ "other targets depend on that one). "
"If an output name is a relative path it will be interpreted "
"relative to the build tree directory corresponding to the current "
"source directory. "
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index a625c47..bac2430 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -58,7 +58,8 @@ bool cmAddExecutableCommand
}
// Special modifiers are not allowed with IMPORTED signature.
- if(importTarget && (use_win32 || use_macbundle || excludeFromAll))
+ if(importTarget
+ && (use_win32 || use_macbundle || excludeFromAll))
{
if(use_win32)
{
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index f522cee..efa29e6 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -31,13 +31,13 @@ bool cmAddLibraryCommand
}
bool excludeFromAll = false;
bool importTarget = false;
-
+
std::vector<std::string>::const_iterator s = args.begin();
std::string libName = *s;
++s;
-
+
// If the second argument is "SHARED" or "STATIC", then it controls
// the type of library. Otherwise, it is treated as a source or
// source list name. There may be two keyword arguments, check for them
@@ -85,11 +85,11 @@ bool cmAddLibraryCommand
}
}
- /* ideally we should check whether for the linker language of the target
+ /* ideally we should check whether for the linker language of the target
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
- STATIC. But at this point we know only the name of the target, but not
+ STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
- if ((type != cmTarget::STATIC_LIBRARY) &&
+ if ((type != cmTarget::STATIC_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
@@ -103,16 +103,16 @@ bool cmAddLibraryCommand
type = cmTarget::STATIC_LIBRARY;
}
- // The IMPORTED signature requires a type to be specified explicitly.
- if(importTarget && !haveSpecifiedType)
- {
- this->SetError("called with IMPORTED argument but no library type.");
- return false;
- }
-
// Handle imported target creation.
if(importTarget)
{
+ // The IMPORTED signature requires a type to be specified explicitly.
+ if (!haveSpecifiedType)
+ {
+ this->SetError("called with IMPORTED argument but no library type.");
+ return false;
+ }
+
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(libName.c_str()))
{
@@ -158,15 +158,14 @@ bool cmAddLibraryCommand
}
std::vector<std::string> srclists;
- while (s != args.end())
+ while (s != args.end())
{
- srclists.push_back(*s);
+ srclists.push_back(*s);
++s;
}
- this->Makefile->AddLibrary(libName.c_str(), type, srclists,
- excludeFromAll);
-
+ this->Makefile->AddLibrary(libName.c_str(), type, srclists, excludeFromAll);
+
return true;
}
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 703ff88..1d247d2 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmBuildCommand
- * \brief Build a CMAKE variable
+ * \brief build_command command
*
- * cmBuildCommand sets a variable to a value with expansion.
+ * cmBuildCommand implements the build_command CMake command
*/
class cmBuildCommand : public cmCommand
{
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 35c0ae0..29a680f 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmBuildNameCommand
- * \brief BuildName a CMAKE variable
+ * \brief build_name command
*
- * cmBuildNameCommand sets a variable to a value with expansion.
+ * cmBuildNameCommand implements the build_name CMake command
*/
class cmBuildNameCommand : public cmCommand
{
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 9bf7ef8..1121386 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmCMakeMinimumRequired
- * \brief Build a CMAKE variable
+ * \brief cmake_minimum_required command
*
- * cmCMakeMinimumRequired sets a variable to a value with expansion.
+ * cmCMakeMinimumRequired implements the cmake_minimum_required CMake command
*/
class cmCMakeMinimumRequired : public cmCommand
{
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index c8374db..ab0bb79 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -849,7 +849,8 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop,
//----------------------------------------------------------------------------
void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
- const char* value)
+ const char* value,
+ bool asString)
{
if(strcmp(prop, "TYPE") == 0)
{
@@ -859,7 +860,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
{
if(value)
{
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
@@ -868,7 +869,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop,
}
else
{
- this->Properties.AppendProperty(prop, value, cmProperty::CACHE);
+ this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString);
}
}
@@ -893,11 +894,12 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v)
//----------------------------------------------------------------------------
void cmCacheManager::CacheIterator::AppendProperty(const char* p,
- const char* v)
+ const char* v,
+ bool asString)
{
if(!this->IsAtEnd())
{
- this->GetEntry().AppendProperty(p, v);
+ this->GetEntry().AppendProperty(p, v, asString);
}
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 314017b..9c94d21 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -41,7 +41,8 @@ private:
cmPropertyMap Properties;
const char* GetProperty(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
bool Initialized;
CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
{}
@@ -61,7 +62,8 @@ public:
bool GetPropertyAsBool(const char*) const ;
bool PropertyExists(const char*) const;
void SetProperty(const char* property, const char* value);
- void AppendProperty(const char* property, const char* value);
+ void AppendProperty(const char* property, const char* value,
+ bool asString=false);
void SetProperty(const char* property, bool value);
const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e3c33a2..c87b64d 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1603,6 +1603,18 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
}
+ // Append library architecture to all implicit platform directories
+ // and add them to the set
+ if(const char* libraryArch =
+ this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"))
+ {
+ for (std::vector<std::string>::const_iterator i = implicitDirVec.begin();
+ i != implicitDirVec.end(); ++i)
+ {
+ this->ImplicitLinkDirs.insert(*i + "/" + libraryArch);
+ }
+ }
+
// Get language-specific implicit directories.
std::string implicitDirVar = "CMAKE_";
implicitDirVar += this->LinkLanguage;
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index a4ca363..3a0ed06 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -276,9 +276,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
for(std::set<cmStdString>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
- cmTarget* transitive_dependee =
- dependee->GetMakefile()->FindTargetToUse(i->c_str());
- this->AddTargetDepend(depender_index, transitive_dependee, false);
+ if(cmTarget* transitive_dependee =
+ dependee->GetMakefile()->FindTargetToUse(i->c_str()))
+ {
+ this->AddTargetDepend(depender_index, transitive_dependee, false);
+ }
}
}
else
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index ea25e60..26125d9 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -719,6 +719,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_DISABLE_FIND_PACKAGE_<PackageName>", cmProperty::VARIABLE,
+ "Variable for disabling find_package() calls.",
+ "Every non-REQUIRED find_package() call in a project can be disabled "
+ "by setting the variable CMAKE_DISABLE_FIND_PACKAGE_<PackageName> to "
+ "TRUE. This can be used to build a project without an optional package, "
+ "although that package is installed.\n"
+ "This switch should be used during the initial CMake run. Otherwise if "
+ "the package has already been found in a previous CMake run, the "
+ "variables which have been stored in the cache will still be there. "
+ "In the case it is recommended to remove the cache variables for "
+ "this package from the cache using the cache editor or cmake -U", false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE,
"Specify a CMake file that overrides platform information.",
"CMake loads the specified file while enabling support for each "
@@ -939,7 +953,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cm->DefineProperty
("WIN32", cmProperty::VARIABLE,
"True on windows systems, including win64.",
- "Set to true when the target system is Windows and on cygwin.",false,
+ "Set to true when the target system is Windows.",false,
"Variables That Describe the System");
cm->DefineProperty
@@ -1071,6 +1085,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_AUTOMOC", cmProperty::VARIABLE,
+ "Whether to handle moc automatically for Qt targets.",
+ "This variable is used to initialize the "
+ "AUTOMOC property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE,
"See variable CMAKE_<CONFIG>_POSTFIX.",
"This variable is a special case of the more-general "
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 4f93067..92dee5a 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -266,10 +266,17 @@ void cmExtraCodeBlocksGenerator
}
// Convert
+ const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
for (std::vector<std::string>::const_iterator jt = listFiles.begin();
jt != listFiles.end();
++jt)
{
+ // don't put cmake's own files into the project (#12110):
+ if (jt->find(cmakeRoot) == 0)
+ {
+ continue;
+ }
+
const std::string &relative = cmSystemTools::RelativePath(
it->second[0]->GetMakefile()->GetHomeDirectory(),
jt->c_str());
@@ -573,15 +580,69 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
" <Option type=\"" << cbTargetType << "\" />\n"
" <Option compiler=\"" << compiler << "\" />\n"
" <Compiler>\n";
+
+ // the compilerdefines for this target
+ const char* cdefs = target->GetMakefile()->GetProperty(
+ "COMPILE_DEFINITIONS");
+ if(cdefs)
+ {
+ // Expand the list.
+ std::vector<std::string> defs;
+ cmSystemTools::ExpandListArgument(cdefs, defs);
+ for(std::vector<std::string>::const_iterator di = defs.begin();
+ di != defs.end(); ++di)
+ {
+ fout <<" <Add option=\"-D" << di->c_str() << "\" />\n";
+ }
+ }
+
// 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();
++dirIt)
{
+ uniqIncludeDirs.insert(*dirIt);
+ }
+
+
+ std::string systemIncludeDirs = makefile->GetSafeDefinition(
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
+ if (!systemIncludeDirs.empty())
+ {
+ std::vector<std::string> dirs;
+ cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
+ for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
+ dirIt != dirs.end();
+ ++dirIt)
+ {
+ uniqIncludeDirs.insert(*dirIt);
+ }
+ }
+
+ systemIncludeDirs = makefile->GetSafeDefinition(
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
+ if (!systemIncludeDirs.empty())
+ {
+ std::vector<std::string> dirs;
+ cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
+ for(std::vector<std::string>::const_iterator dirIt=dirs.begin();
+ dirIt != dirs.end();
+ ++dirIt)
+ {
+ uniqIncludeDirs.insert(*dirIt);
+ }
+ }
+
+ for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();
+ dirIt != uniqIncludeDirs.end();
+ ++dirIt)
+ {
fout <<" <Add directory=\"" << dirIt->c_str() << "\" />\n";
}
+
fout<<" </Compiler>\n";
}
else // e.g. all and the GLOBAL and UTILITY targets
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 8e26b8e..1dd9bf3 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -654,7 +654,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
}
// add system defined c macros
- const char* cDefs=mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_DEFINED_MACROS");
+ const char* cDefs=mf->GetDefinition(
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS");
if(cDefs)
{
// Expand the list.
@@ -689,7 +690,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
// add system defined c++ macros
const char* cxxDefs = mf->GetDefinition(
- "CMAKE_ECLIPSE_CXX_SYSTEM_DEFINED_MACROS");
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS");
if(cxxDefs)
{
// Expand the list.
@@ -737,12 +738,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// now also the system include directories, in case we found them in
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
// standard headers.
- mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS");
std::string compiler = mf->GetSafeDefinition("CMAKE_C_COMPILER");
if (!compiler.empty())
{
std::string systemIncludeDirs = mf->GetSafeDefinition(
- "CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
this->AppendIncludeDirectories(fout, dirs, emmited);
@@ -751,7 +751,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
if (!compiler.empty())
{
std::string systemIncludeDirs = mf->GetSafeDefinition(
- "CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS");
+ "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs);
this->AppendIncludeDirectories(fout, dirs, emmited);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 5f106bc..2e72b58 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -191,6 +191,9 @@ void cmFindPackageCommand::GenerateDocumentation()
"\"<config-file>-version.cmake\" or \"<config-file>Version.cmake\". "
"If no such version file is available then the configuration file "
"is assumed to not be compatible with any requested version. "
+ "A basic version file containing generic version matching code can be "
+ "created using the macro write_basic_config_version_file(), see its "
+ "documentation for more details. "
"When a version file is found it is loaded to check the requested "
"version number. "
"The version file is loaded in a nested scope in which the following "
@@ -335,6 +338,10 @@ void cmFindPackageCommand::GenerateDocumentation()
this->CommandDocumentation += this->GenericDocumentationPathsOrder;
this->CommandDocumentation +=
"\n"
+ "Every non-REQUIRED find_package() call can be disabled by setting the "
+ "variable CMAKE_DISABLE_FIND_PACKAGE_<package> to TRUE. See the "
+ "documentation for the CMAKE_DISABLE_FIND_PACKAGE_<package> variable for "
+ "more information.\n"
"See the cmake_policy() command documentation for discussion of the "
"NO_POLICY_SCOPE option."
;
@@ -607,6 +614,24 @@ bool cmFindPackageCommand
}
}
+ std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_";
+ disableFindPackageVar += this->Name;
+ if(this->Makefile->IsOn(disableFindPackageVar.c_str()))
+ {
+ if (this->Required)
+ {
+ cmOStringStream e;
+ e << "for module " << this->Name << " called with REQUIRED, but "
+ << disableFindPackageVar
+ << " is enabled. A REQUIRED package cannot be disabled.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ return true;
+ }
+
+
this->SetModuleVariables(components);
// See if there is a Find<package>.cmake module.
@@ -1174,20 +1199,20 @@ void cmFindPackageCommand::AppendSuccessInformation()
if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult)))
{
this->AppendToProperty("PACKAGES_FOUND");
- if (!this->Quiet)
- {
- this->AppendToProperty("ENABLED_FEATURES");
- }
}
else
{
this->AppendToProperty("PACKAGES_NOT_FOUND");
- if (!this->Quiet)
- {
- this->AppendToProperty("DISABLED_FEATURES");
- }
}
+ // Record whether the find was quiet or not, so this can be used
+ // e.g. in FeatureSummary.cmake
+ std::string quietInfoPropName = "_CMAKE_";
+ quietInfoPropName += this->Name;
+ quietInfoPropName += "_QUIET";
+ this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName.c_str(),
+ this->Quiet ? "TRUE" : "FALSE");
+
// set a global property to record the required version of this package
std::string versionInfoPropName = "_CMAKE_";
versionInfoPropName += this->Name;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 31035cd..d62fb44 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmExternalMakefileProjectGenerator.h"
#include "cmake.h"
#include "cmMakefile.h"
+#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmExportInstallFileGenerator.h"
@@ -269,7 +270,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmOStringStream windowsVersionString;
windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
windowsVersionString.str();
- mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
+ mf->AddDefinition("CMAKE_HOST_SYSTEM_VERSION",
windowsVersionString.str().c_str());
#endif
// Read the DetermineSystem file
@@ -618,8 +619,8 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
if (sscanf(linkerPref, "%d", &preference)!=1)
{
// backward compatibility: before 2.6 LINKER_PREFERENCE
- // was either "None" or "Prefered", and only the first character was
- // tested. So if there is a custom language out there and it is
+ // was either "None" or "Prefered", and only the first character was
+ // tested. So if there is a custom language out there and it is
// "Prefered", set its preference high
if (linkerPref[0]=='P')
{
@@ -832,6 +833,10 @@ void cmGlobalGenerator::Generate()
return;
}
+ // Iterate through all targets and set up automoc for those which have
+ // the AUTOMOC property set
+ this->CreateAutomocTargets();
+
// For each existing cmLocalGenerator
unsigned int i;
@@ -950,6 +955,35 @@ bool cmGlobalGenerator::CheckTargets()
return true;
}
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::CreateAutomocTargets()
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
+ {
+ cmTargets& targets =
+ this->LocalGenerators[i]->GetMakefile()->GetTargets();
+ for(cmTargets::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ cmTarget& target = ti->second;
+ if(target.GetType() == cmTarget::EXECUTABLE ||
+ target.GetType() == cmTarget::STATIC_LIBRARY ||
+ target.GetType() == cmTarget::SHARED_LIBRARY ||
+ target.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
+ {
+ cmQtAutomoc automoc;
+ automoc.SetupAutomocTarget(&target);
+ }
+ }
+ }
+ }
+#endif
+}
+
+
void cmGlobalGenerator::CheckLocalGenerators()
{
std::map<cmStdString, cmStdString> notFoundMap;
@@ -1019,9 +1053,9 @@ void cmGlobalGenerator::CheckLocalGenerators()
if(notFoundMap.size())
{
std::string notFoundVars;
- for(std::map<cmStdString, cmStdString>::const_iterator
+ for(std::map<cmStdString, cmStdString>::const_iterator
ii = notFoundMap.begin();
- ii != notFoundMap.end();
+ ii != notFoundMap.end();
++ii)
{
notFoundVars += ii->first;
@@ -1057,7 +1091,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
{
this->FirstTimeProgress = 0.95f;
}
- this->CMakeInstance->UpdateProgress("Configuring",
+ this->CMakeInstance->UpdateProgress("Configuring",
this->FirstTimeProgress);
}
@@ -1136,7 +1170,7 @@ int cmGlobalGenerator::Build(
const char *config,
bool clean, bool fast,
double timeout,
- bool verbose,
+ cmSystemTools::OutputOption outputflag,
const char* extraOptions,
std::vector<std::string> const& nativeOptions)
{
@@ -1161,7 +1195,7 @@ int cmGlobalGenerator::Build(
{
outputPtr = &outputBuffer;
}
-
+
// should we do a clean first?
if (clean)
{
@@ -1176,7 +1210,7 @@ int cmGlobalGenerator::Build(
}
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), outputPtr,
- &retVal, 0, verbose, timeout))
+ &retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make clean failed.");
@@ -1199,7 +1233,7 @@ int cmGlobalGenerator::Build(
// now build
std::string makeCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName,
- extraOptions, target,
+ extraOptions, target,
config, false, fast);
if(output)
{
@@ -1217,7 +1251,7 @@ int cmGlobalGenerator::Build(
}
if (!cmSystemTools::RunSingleCommand(command, outputPtr,
- &retVal, 0, verbose, timeout))
+ &retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error
@@ -1272,8 +1306,8 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
if(this->FirstTimeProgress > 0.95f)
{
this->FirstTimeProgress = 0.95f;
- }
- this->CMakeInstance->UpdateProgress("Configuring",
+ }
+ this->CMakeInstance->UpdateProgress("Configuring",
this->FirstTimeProgress);
return;
}
@@ -1296,8 +1330,8 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
-void cmGlobalGenerator::AddTargetToExports(const char* exportSetName,
- cmTarget* target,
+void cmGlobalGenerator::AddTargetToExports(const char* exportSetName,
+ cmTarget* target,
cmInstallTargetGenerator* archive,
cmInstallTargetGenerator* runTime,
cmInstallTargetGenerator* library,
@@ -1331,7 +1365,7 @@ void cmGlobalGenerator::ClearExportSets()
const std::vector<cmTargetExport*>* cmGlobalGenerator::GetExportSet(
const char* name) const
{
- std::map<cmStdString, std::vector<cmTargetExport*> >::const_iterator
+ std::map<cmStdString, std::vector<cmTargetExport*> >::const_iterator
exportSetIt = this->ExportSets.find(name);
if (exportSetIt != this->ExportSets.end())
{
@@ -1443,7 +1477,7 @@ void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
int cmGlobalGenerator::GetLinkerPreference(const char* lang)
{
- std::map<cmStdString, int>::const_iterator it =
+ std::map<cmStdString, int>::const_iterator it =
this->LanguageToLinkerPreference.find(lang);
if (it != this->LanguageToLinkerPreference.end())
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5268731..88eb8b6 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -17,7 +17,7 @@
#include "cmTarget.h" // For cmTargets
#include "cmTargetDepend.h" // For cmTargetDependSet
-
+#include "cmSystemTools.h" // for cmSystemTools::OutputOption
class cmake;
class cmMakefile;
class cmLocalGenerator;
@@ -102,7 +102,8 @@ public:
std::string *output,
const char *makeProgram, const char *config,
bool clean, bool fast,
- double timeout, bool verbose=false,
+ double timeout,
+ cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
const char* extraOptions = 0,
std::vector<std::string> const& nativeOptions =
std::vector<std::string>());
@@ -281,6 +282,8 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
bool CheckTargets();
+ void CreateAutomocTargets();
+
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 2f558dc..a9e7798 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -66,18 +66,6 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
lg->SetMinGWMake(true);
-
- // mingw32-make has trouble running code like
- //
- // @echo message with spaces
- //
- // If quotes are added
- //
- // @echo "message with spaces"
- //
- // it runs but the quotes are displayed. Instead just use cmake to
- // echo.
- lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 328a3da..ec8f4a5 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -175,3 +175,39 @@ std::string cmGlobalVisualStudio10Generator
}
return makeCommand;
}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
+{
+ if(!this->PlatformToolset.empty())
+ {
+ return true;
+ }
+ // This edition does not come with 64-bit tools. Look for them.
+ //
+ // TODO: Detect available tools? x64\v100 exists but does not work?
+ // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
+ // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
+ // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
+ std::string winSDK_7_1;
+ if(cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
+ "Windows\\v7.1;InstallationFolder", winSDK_7_1))
+ {
+ cmOStringStream m;
+ m << "Found Windows SDK v7.1: " << winSDK_7_1;
+ mf->DisplayStatus(m.str().c_str(), -1);
+ this->PlatformToolset = "Windows7.1SDK";
+ return true;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
+ << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
+ << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+}
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index bef5642..8573670 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -74,6 +74,7 @@ public:
virtual std::string GetUserMacrosRegKeyBase();
virtual const char* GetCMakeCFGInitDirectory()
{ return "$(Configuration)";}
+ bool Find64BitTools(cmMakefile* mf);
protected:
virtual const char* GetIDEVersion() { return "10.0"; }
diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx
new file mode 100644
index 0000000..5f70f6b
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10IA64Generator.cxx
@@ -0,0 +1,51 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmGlobalVisualStudio10IA64Generator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator()
+{
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 10 Itanium project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
+ mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
+ mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10IA64Generator
+::EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile* mf, bool optional)
+{
+ if(this->IsExpressEdition() && !this->Find64BitTools(mf))
+ {
+ return;
+ }
+ this->cmGlobalVisualStudio10Generator
+ ::EnableLanguage(languages, mf, optional);
+}
diff --git a/Source/cmGlobalVisualStudio10IA64Generator.h b/Source/cmGlobalVisualStudio10IA64Generator.h
new file mode 100644
index 0000000..a088272
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10IA64Generator.h
@@ -0,0 +1,40 @@
+/*============================================================================
+ 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 cmGlobalVisualStudio10IA64Generator_h
+#define cmGlobalVisualStudio10IA64Generator_h
+
+#include "cmGlobalVisualStudio10Generator.h"
+
+class cmGlobalVisualStudio10IA64Generator :
+ public cmGlobalVisualStudio10Generator
+{
+public:
+ cmGlobalVisualStudio10IA64Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio10IA64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio10IA64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 10 IA64";}
+
+ virtual const char* GetPlatformName() const {return "Itanium";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ virtual void AddPlatformDefinitions(cmMakefile* mf);
+
+ virtual void EnableLanguage(std::vector<std::string>const& languages,
+ cmMakefile *, bool optional);
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx
index 8600777..49dc473 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx
@@ -38,42 +38,6 @@ void cmGlobalVisualStudio10Win64Generator
}
//----------------------------------------------------------------------------
-bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf)
-{
- if(!this->PlatformToolset.empty())
- {
- return true;
- }
- // This edition does not come with 64-bit tools. Look for them.
- //
- // TODO: Detect available tools? x64\v100 exists but does not work?
- // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
- // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
- // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
- std::string winSDK_7_1;
- if(cmSystemTools::ReadRegistryValue(
- "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
- "Windows\\v7.1;InstallationFolder", winSDK_7_1))
- {
- cmOStringStream m;
- m << "Found Windows SDK v7.1: " << winSDK_7_1;
- mf->DisplayStatus(m.str().c_str(), -1);
- this->PlatformToolset = "Windows7.1SDK";
- return true;
- }
- else
- {
- cmOStringStream e;
- e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
- << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
- << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
- cmSystemTools::SetFatalErrorOccured();
- return false;
- }
-}
-
-//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Win64Generator
::EnableLanguage(std::vector<std::string> const& languages,
cmMakefile* mf, bool optional)
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
index e6d3dc5..8a2de4c 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.h
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -34,7 +34,6 @@ public:
virtual void AddPlatformDefinitions(cmMakefile* mf);
- bool Find64BitTools(cmMakefile* mf);
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
};
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 51b8918..84e7f1b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -739,18 +739,6 @@ void cmGlobalVisualStudio7Generator
entry.Full = "";
}
-// make sure "special" targets have GUID's
-void cmGlobalVisualStudio7Generator::Configure()
-{
- cmGlobalGenerator::Configure();
- this->CreateGUID("ALL_BUILD");
- this->CreateGUID("INSTALL");
- this->CreateGUID("RUN_TESTS");
- this->CreateGUID("EDIT_CACHE");
- this->CreateGUID("REBUILD_CACHE");
- this->CreateGUID("PACKAGE");
-}
-
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio7Generator
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index b6c84e8..7f19d83 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -80,9 +80,6 @@ public:
void CreateGUID(const char* name);
std::string GetGUID(const char* name);
- ///! do configure step
- virtual void Configure();
-
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx
new file mode 100644
index 0000000..d49739b
--- /dev/null
+++ b/Source/cmGlobalVisualStudio9IA64Generator.cxx
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmGlobalVisualStudio9IA64Generator.h"
+#include "cmLocalVisualStudio7Generator.h"
+#include "cmMakefile.h"
+
+
+cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator()
+{
+ this->ArchitectureId = "Itanium";
+}
+
+///! Create a local generator appropriate to this Global Generator
+cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator()
+{
+ cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
+ lg->SetVersion9();
+ lg->SetPlatformName(this->GetPlatformName());
+ lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
+ lg->SetGlobalGenerator(this);
+ return lg;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio9IA64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 9 2008 Itanium project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio9IA64Generator
+::AddPlatformDefinitions(cmMakefile* mf)
+{
+ cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
+ mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
+}
diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h
new file mode 100644
index 0000000..e33ee15
--- /dev/null
+++ b/Source/cmGlobalVisualStudio9IA64Generator.h
@@ -0,0 +1,50 @@
+/*============================================================================
+ 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 cmGlobalVisualStudio9IA64Generator_h
+#define cmGlobalVisualStudio9IA64Generator_h
+
+#include "cmGlobalVisualStudio9Generator.h"
+
+
+/** \class cmGlobalVisualStudio8IA64Generator
+ * \brief Write a Unix makefiles.
+ *
+ * cmGlobalVisualStudio8IA64Generator manages UNIX build process for a tree
+ */
+class cmGlobalVisualStudio9IA64Generator :
+ public cmGlobalVisualStudio9Generator
+{
+public:
+ cmGlobalVisualStudio9IA64Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio9IA64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio9IA64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 9 2008 IA64";}
+
+ virtual const char* GetPlatformName() const {return "Itanium";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ ///! create the correct local generator
+ virtual cmLocalGenerator *CreateLocalGenerator();
+
+ /**
+ * Try to determine system infomation such as shared library
+ * extension, pthreads, byte order etc.
+ */
+ virtual void AddPlatformDefinitions(cmMakefile *);
+};
+#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2cbd3ed..73967912 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -336,6 +336,9 @@ cmGlobalXCodeGenerator::PostBuildMakeTarget(std::string const& tName,
}
//----------------------------------------------------------------------------
+#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
+
+//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& gens)
@@ -366,8 +369,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
makecommand.push_back(this->CurrentXCodeHackMakefile.c_str());
makecommand.push_back(""); // placeholder, see below
- // Add Re-Run CMake rules
- this->CreateReRunCMakeFile(root, gens);
+ // Add ZERO_CHECK
+ bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION");
+ if (regenerate)
+ {
+ this->CreateReRunCMakeFile(root, gens);
+ std::string file = this->ConvertToRelativeForMake(
+ this->CurrentReRunCMakeMakefile.c_str());
+ cmSystemTools::ReplaceString(file, "\\ ", " ");
+ mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_depends,
+ no_working_directory,
+ "make", "-f", file.c_str());
+ }
// now make the allbuild depend on all the non-utility targets
// in the project
@@ -379,10 +392,17 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
{
continue;
}
+
cmTargets& tgts = lg->GetMakefile()->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
cmTarget& target = l->second;
+
+ if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
+ {
+ target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ }
+
// make all exe, shared libs and modules
// run the depend check makefile as a post build rule
// this will make sure that when the next target is built
@@ -402,8 +422,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
cmTarget::POST_BUILD,
"Depend check for xcode",
dir.c_str());
-
}
+
if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
allbuild->AddUtility(target.GetName());
@@ -1114,11 +1134,6 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
commands.push_back(*(*i)->GetCustomCommand());
}
}
- std::vector<cmCustomCommand> reruncom;
- cmXCodeObject* cmakeReRunPhase =
- this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase",
- cmtarget, reruncom);
- buildPhases->AddObject(cmakeReRunPhase);
// create prebuild phase
cmXCodeObject* cmakeRulesBuildPhase =
this->CreateBuildPhase("CMake Rules",
@@ -1207,20 +1222,6 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
const & commands,
const char* name)
{
- if(strcmp(name, "cmakeReRunPhase") == 0)
- {
- std::string cdir = this->CurrentMakefile->GetHomeOutputDirectory();
- cdir = this->ConvertToRelativeForMake(cdir.c_str());
- std::string makecmd = "make -C ";
- makecmd += cdir;
- makecmd += " -f ";
- makecmd +=
- this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
- cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
- buildphase->AddAttribute("shellScript",
- this->CreateString(makecmd.c_str()));
- return;
- }
// collect multiple outputs of custom commands into a set
// which will be used for every configuration
@@ -1480,7 +1481,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
BuildObjectListOrString ppDefs(this, this->XcodeVersion >= 30);
if(this->XcodeVersion > 15)
{
- this->AppendDefines(ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)\"");
+ this->AppendDefines(ppDefs,
+ "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
}
if(const char* exportMacro = target.GetExportMacro())
{
@@ -1597,9 +1599,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(this->XcodeVersion >= 21)
{
- std::string pncdir = target.GetDirectory(configName);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir.c_str()));
+ if(!target.UsesDefaultOutputDir(configName, false))
+ {
+ std::string pncdir = target.GetDirectory(configName);
+ buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+ this->CreateString(pncdir.c_str()));
+ }
}
else
{
@@ -1753,7 +1758,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
default:
break;
}
- if(this->XcodeVersion >= 22)
+ if(this->XcodeVersion >= 22 && this->XcodeVersion < 40)
{
buildSettings->AddAttribute("PREBINDING",
this->CreateString("NO"));
@@ -2399,10 +2404,11 @@ void cmGlobalXCodeGenerator
{
if(this->XcodeVersion > 15)
{
- // now add the same one but append $(CONFIGURATION) to it:
+ // Now add the same one but append
+ // $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
linkDirs += " ";
linkDirs += this->XCodeEscapePath(
- (*libDir + "/$(CONFIGURATION)").c_str());
+ (*libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)").c_str());
}
linkDirs += " ";
linkDirs += this->XCodeEscapePath(libDir->c_str());
@@ -3173,7 +3179,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
//----------------------------------------------------------------------------
const char* cmGlobalXCodeGenerator::GetCMakeCFGInitDirectory()
{
- return this->XcodeVersion >= 21? "$(CONFIGURATION)" : ".";
+ return this->XcodeVersion >= 21 ?
+ "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" : ".";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5c2cda1..6ab5c2a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -68,8 +68,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->ColorMakefile = false;
this->SkipPreprocessedSourceRules = false;
this->SkipAssemblySourceRules = false;
- this->NativeEchoCommand = "@echo ";
- this->NativeEchoWindows = true;
this->MakeCommandEscapeTargetTwice = false;
this->IsMakefileGenerator = true;
this->BorlandMakeCurlyHack = false;
@@ -1235,9 +1233,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
if(color_name.empty())
{
// Use the native echo command.
- cmd = this->NativeEchoCommand;
- cmd += this->EscapeForShell(line.c_str(), false,
- this->NativeEchoWindows);
+ cmd = "@echo ";
+ cmd += this->EscapeForShell(line.c_str(), false, true);
}
else
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 9ff6e5e..0994222 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -127,14 +127,6 @@ public:
void SetSilentNoColon(bool v) {this->SilentNoColon = v;}
/**
- * Set the command to use for native make shell echo. The value
- * should include all parts of the command up to the beginning of
- * the message (including a whitespace separator).
- */
- void SetNativeEchoCommand(const char* cmd, bool isWindows)
- { this->NativeEchoCommand = cmd; this->NativeEchoWindows = isWindows; }
-
- /**
* Set the string used to include one makefile into another default
* is include.
*/
@@ -365,8 +357,6 @@ private:
std::string IncludeDirective;
std::string MakeSilentFlag;
std::string ConfigurationName;
- std::string NativeEchoCommand;
- bool NativeEchoWindows;
bool DefineWindowsNULL;
bool UnixCD;
bool PassMakeflags;
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 1850c16..ef378f9 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -93,10 +93,18 @@ void cmLocalVisualStudio10Generator::Generate()
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
- cmVisualStudio10TargetGenerator tg(
- &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
- this->GetGlobalGenerator()));
- tg.Generate();
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(l->second))
+ {
+ this->CreateSingleVCProj(l->first.c_str(),l->second);
+ }
+ else
+ {
+ cmVisualStudio10TargetGenerator tg(
+ &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+ this->GetGlobalGenerator()));
+ tg.Generate();
+ }
}
this->WriteStampFiles();
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7a62b9c..1f99cba 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -68,6 +68,27 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
lang.insert("DEF");
lang.insert("Fortran");
this->CreateCustomTargetsAndCommands(lang);
+
+ // Now create GUIDs for targets
+ cmTargets &tgts = this->Makefile->GetTargets();
+
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+ for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+ {
+ const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
+ if(path)
+ {
+ this->ReadAndStoreExternalGUID(
+ l->second.GetName(), path);
+ }
+ else
+ {
+ gg->CreateGUID(l->first.c_str());
+ }
+ }
+
+
this->FixGlobalTargets();
}
@@ -825,6 +846,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
tool = "VFMIDLTool";
}
fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n";
+ fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
+ for(i = includes.begin(); i != includes.end(); ++i)
+ {
+ std::string ipath = this->ConvertToXMLOutputPath(i->c_str());
+ fout << ipath << ";";
+ }
+ fout << "\"\n";
fout << "\t\t\t\tMkTypLibCompatible=\"FALSE\"\n";
if( this->PlatformName == "x64" )
{
@@ -1279,7 +1307,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
fout << "\t</Files>\n";
// Write the VCProj file's footer.
- this->WriteVCProjFooter(fout);
+ this->WriteVCProjFooter(fout, target);
}
struct cmLVS7GFileConfig
@@ -1622,6 +1650,10 @@ WriteCustomRule(std::ostream& fout,
}
std::string script = this->ConstructScript(command, i->c_str());
+ if(this->FortranProject)
+ {
+ cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
+ }
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
@@ -1880,10 +1912,28 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
}
-void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout)
+void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout,
+ cmTarget &target)
{
- fout << "\t<Globals>\n"
- << "\t</Globals>\n"
+ fout << "\t<Globals>\n";
+
+ cmPropertyMap const& props = target.GetProperties();
+ for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
+ {
+ if(i->first.find("VS_GLOBAL_") == 0)
+ {
+ std::string name = i->first.substr(10);
+ if(name != "")
+ {
+ fout << "\t\t<Global\n"
+ << "\t\t\tName=\"" << name << "\"\n"
+ << "\t\t\tValue=\"" << i->second.GetValue() << "\"\n"
+ << "\t\t/>\n";
+ }
+ }
+ }
+
+ fout << "\t</Globals>\n"
<< "</VisualStudioProject>\n";
}
@@ -2003,29 +2053,6 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
}
-void cmLocalVisualStudio7Generator::ConfigureFinalPass()
-{
- cmLocalGenerator::ConfigureFinalPass();
- cmTargets &tgts = this->Makefile->GetTargets();
-
- cmGlobalVisualStudio7Generator* gg =
- static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
- for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
- {
- const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
- if(path)
- {
- this->ReadAndStoreExternalGUID(
- l->second.GetName(), path);
- }
- else
- {
- gg->CreateGUID(l->first.c_str());
- }
- }
-
-}
-
//----------------------------------------------------------------------------
std::string cmLocalVisualStudio7Generator
::GetTargetDirectory(cmTarget const& target) const
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 160e2d4..cdd714e 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -57,7 +57,6 @@ public:
void SetVersion8() {this->Version = 8;}
void SetVersion9() {this->Version = 9;}
void SetPlatformName(const char* n) { this->PlatformName = n;}
- virtual void ConfigureFinalPass();
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
dirs);
@@ -75,6 +74,8 @@ public:
virtual void ReadAndStoreExternalGUID(const char* name,
const char* path);
+protected:
+ void CreateSingleVCProj(const char *lname, cmTarget &tgt);
private:
typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
@@ -84,8 +85,7 @@ private:
void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
- void WriteVCProjFooter(std::ostream& fout);
- void CreateSingleVCProj(const char *lname, cmTarget &tgt);
+ void WriteVCProjFooter(std::ostream& fout, cmTarget &target);
void WriteVCProjFile(std::ostream& fout, const char *libName,
cmTarget &tgt);
void WriteConfigurations(std::ostream& fout,
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b94db48..e5b5443 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1761,6 +1761,10 @@ void cmMakefile::AddDefinition(const char* name, bool value)
void cmMakefile::CheckForUnusedVariables() const
{
+ if (!this->WarnUnused)
+ {
+ return;
+ }
const cmDefinitions& defs = this->Internal->VarStack.top();
const std::set<cmStdString>& locals = defs.LocalKeys();
std::set<cmStdString>::const_iterator it = locals.begin();
@@ -1884,7 +1888,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
}
-void cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
+cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll)
{
@@ -1907,6 +1911,7 @@ void cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
}
target->AddSources(srcs);
this->AddGlobalLinkInformation(lname, *target);
+ return target;
}
cmTarget* cmMakefile::AddExecutable(const char *exeName,
@@ -3341,7 +3346,8 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
}
-void cmMakefile::AppendProperty(const char* prop, const char* value)
+void cmMakefile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
@@ -3374,7 +3380,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value)
return;
}
- this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY);
+ this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
}
const char *cmMakefile::GetPropertyOrDefinition(const char* prop)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1c1aef3..618f4f3 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -325,7 +325,7 @@ public:
/**
* Set the name of the library.
*/
- void AddLibrary(const char *libname, cmTarget::TargetType type,
+ cmTarget* AddLibrary(const char *libname, cmTarget::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll = false);
@@ -799,7 +799,7 @@ public:
///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetPropertyOrDefinition(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 0a5eb9e..26e0a07 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmMarkAsAdvancedCommand
- * \brief MarkAsAdvanced a CMAKE variable
+ * \brief mark_as_advanced command
*
- * cmMarkAsAdvancedCommand sets a variable to a value with expansion.
+ * cmMarkAsAdvancedCommand implements the mark_as_advanced CMake command
*/
class cmMarkAsAdvancedCommand : public cmCommand
{
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 166bd00..3b37cf3 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -19,10 +19,10 @@ void cmProperty::Set(const char *name, const char *value)
this->ValueHasBeenSet = true;
}
-void cmProperty::Append(const char *name, const char *value)
+void cmProperty::Append(const char *name, const char *value, bool asString)
{
this->Name = name;
- if(!this->Value.empty() && *value)
+ if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
}
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 71bd1e7..e0fcd63 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -24,7 +24,7 @@ public:
void Set(const char *name, const char *value);
// append to this property
- void Append(const char *name, const char *value);
+ void Append(const char *name, const char *value, bool asString = false);
// get the value
const char *GetValue() const;
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 052b811..a4d0bf3 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -59,7 +59,7 @@ void cmPropertyMap::SetProperty(const char *name, const char *value,
}
void cmPropertyMap::AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope, bool asString)
{
// Skip if nothing to append.
if(!name || !value || !*value)
@@ -81,7 +81,7 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value,
#endif
cmProperty *prop = this->GetOrCreateProperty(name);
- prop->Append(name,value);
+ prop->Append(name,value,asString);
}
const char *cmPropertyMap
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 02fb060..94275e2 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -25,7 +25,7 @@ public:
cmProperty::ScopeType scope);
void AppendProperty(const char* name, const char* value,
- cmProperty::ScopeType scope);
+ cmProperty::ScopeType scope, bool asString=false);
const char *GetPropertyValue(const char *name,
cmProperty::ScopeType scope,
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
new file mode 100644
index 0000000..ff96e5b
--- /dev/null
+++ b/Source/cmQtAutomoc.cxx
@@ -0,0 +1,782 @@
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+
+# include <cmsys/Terminal.h>
+
+#include "cmQtAutomoc.h"
+
+
+cmQtAutomoc::cmQtAutomoc()
+:Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
+,ColorOutput(true)
+,RunMocFailed(false)
+,GenerateAll(false)
+{
+
+ std::string colorEnv = "";
+ cmsys::SystemTools::GetEnv("COLOR", colorEnv);
+ if(!colorEnv.empty())
+ {
+ if(cmSystemTools::IsOn(colorEnv.c_str()))
+ {
+ this->ColorOutput = true;
+ }
+ else
+ {
+ this->ColorOutput = false;
+ }
+ }
+}
+
+
+void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
+{
+ cmMakefile* makefile = target->GetMakefile();
+ const char* targetName = target->GetName();
+ // don't do anything if there is no Qt4:
+ std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion != "4")
+ {
+ return;
+ }
+
+ // create a custom target for running automoc at buildtime:
+ std::string automocTargetName = targetName;
+ automocTargetName += "_automoc";
+
+ std::string targetDir = makefile->GetCurrentOutputDirectory();
+ targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
+ targetDir += "/";
+ targetDir += automocTargetName;
+ targetDir += ".dir/";
+
+ cmCustomCommandLine currentLine;
+ currentLine.push_back(makefile->GetCMakeInstance()->GetCMakeCommand());
+ currentLine.push_back("-E");
+ currentLine.push_back("cmake_automoc");
+ currentLine.push_back(targetDir);
+
+ cmCustomCommandLines commandLines;
+ commandLines.push_back(currentLine);
+
+ std::string workingDirectory = cmSystemTools::CollapseFullPath(
+ "", makefile->GetCurrentOutputDirectory());
+
+ std::vector<std::string> depends;
+ std::string automocComment = "Automoc for target ";
+ automocComment += targetName;
+
+ makefile->AddUtilityCommand(automocTargetName.c_str(), true,
+ workingDirectory.c_str(), depends,
+ commandLines, false, automocComment.c_str());
+ target->AddUtility(automocTargetName.c_str());
+
+ // configure a file to get all information to automoc at buildtime:
+ std::string _moc_files;
+ std::string _moc_headers;
+ const char* sepFiles = "";
+ const char* sepHeaders = "";
+
+ const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string absFile = sf->GetFullPath();
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
+ bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
+
+ if ((skip==false) && (generated == false))
+ {
+ std::string ext = sf->GetExtension();
+ cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat(
+ ext.c_str());
+ if (fileType == cmSystemTools::CXX_FILE_FORMAT)
+ {
+ _moc_files += sepFiles;
+ _moc_files += absFile;
+ sepFiles = ";";
+ }
+ else if (fileType == cmSystemTools::HEADER_FILE_FORMAT)
+ {
+ _moc_headers += sepHeaders;
+ _moc_headers += absFile;
+ sepHeaders = ";";
+ }
+ }
+ }
+
+ std::string _moc_incs = makefile->GetProperty("INCLUDE_DIRECTORIES");
+ std::string _moc_defs = makefile->GetProperty("DEFINITIONS");
+ std::string _moc_compile_defs = makefile->GetProperty("COMPILE_DEFINITIONS");
+ // forget the variables added here afterwards again:
+ cmMakefile::ScopePushPop varScope(makefile);
+ static_cast<void>(varScope);
+
+ makefile->AddDefinition("_moc_target_name", automocTargetName.c_str());
+ makefile->AddDefinition("_moc_incs", _moc_incs.c_str());
+ makefile->AddDefinition("_moc_defs", _moc_defs.c_str());
+ makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
+ makefile->AddDefinition("_moc_files", _moc_files.c_str());
+ makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
+
+ const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT");
+ std::string inputFile = cmakeRoot;
+ inputFile += "/Modules/AutomocInfo.cmake.in";
+ std::string outputFile = targetDir;
+ outputFile += "/AutomocInfo.cmake";
+ makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(),
+ false, true, false);
+
+ std::string mocCppFile = makefile->GetCurrentOutputDirectory();
+ mocCppFile += "/";
+ mocCppFile += automocTargetName;
+ mocCppFile += ".cpp";
+ cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
+ true);
+ target->AddSourceFile(mocCppSource);
+
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ mocCppFile.c_str(), false);
+}
+
+
+bool cmQtAutomoc::Run(const char* targetDirectory)
+{
+ cmake cm;
+ cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
+ cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
+
+ this->ReadAutomocInfoFile(makefile, targetDirectory);
+ this->ReadOldMocDefinitionsFile(makefile, targetDirectory);
+
+ this->Init();
+
+ if (this->QtMajorVersion == "4")
+ {
+ this->RunAutomocQt4();
+ }
+
+ this->WriteOldMocDefinitionsFile(targetDirectory);
+
+ delete gg;
+ gg = NULL;
+ makefile = NULL;
+ return true;
+}
+
+
+cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory)
+{
+ cmGlobalGenerator* gg = new cmGlobalGenerator();
+ gg->SetCMakeInstance(cm);
+
+ cmLocalGenerator* lg = gg->CreateLocalGenerator();
+ lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetHomeDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartDirectory(targetDirectory);
+ gg->SetCurrentLocalGenerator(lg);
+
+ return gg;
+}
+
+
+bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocInfo.cmake";
+
+ if (!makefile->ReadListFile(0, filename.c_str()))
+ {
+ cmSystemTools::Error("Error processing file:", filename.c_str());
+ return false;
+ }
+
+ this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
+ this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
+ this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
+ this->IncludeProjectDirsBefore = makefile->IsOn(
+ "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
+ this->Srcdir = makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR");
+ this->Builddir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
+ this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
+ this->MocCompileDefinitionsStr = makefile->GetSafeDefinition(
+ "AM_MOC_COMPILE_DEFINITIONS");
+ this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS");
+ this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES");
+ this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
+ this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
+ this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
+
+ return true;
+}
+
+
+bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocOldMocDefinitions.cmake";
+
+ if (makefile->ReadListFile(0, filename.c_str()))
+ {
+ this->OldMocDefinitionsStr =
+ makefile->GetSafeDefinition("AM_OLD_MOC_DEFINITIONS");
+ }
+ return true;
+}
+
+
+void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
+{
+ std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
+ cmSystemTools::ConvertToUnixSlashes(filename);
+ filename += "/AutomocOldMocDefinitions.cmake";
+
+ std::fstream outfile;
+ outfile.open(filename.c_str(),
+ std::ios::out | std::ios::trunc);
+ outfile << "set(AM_OLD_MOC_DEFINITIONS \""
+ << this->Join(this->MocDefinitions, ' ') << "\")\n";
+
+ outfile.close();
+}
+
+
+void cmQtAutomoc::Init()
+{
+ this->OutMocCppFilename = this->Builddir;
+ this->OutMocCppFilename += this->TargetName;
+ this->OutMocCppFilename += ".cpp";
+
+ std::vector<std::string> cdefList;
+ cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
+ if (!cdefList.empty())
+ {
+ for(std::vector<std::string>::const_iterator it = cdefList.begin();
+ it != cdefList.end();
+ ++it)
+ {
+ this->MocDefinitions.push_back("-D" + (*it));
+ }
+ }
+ else
+ {
+ std::string tmpMocDefs = this->MocDefinitionsStr;
+ cmSystemTools::ReplaceString(tmpMocDefs, " ", ";");
+
+ std::vector<std::string> defList;
+ cmSystemTools::ExpandListArgument(tmpMocDefs, defList);
+
+ for(std::vector<std::string>::const_iterator it = defList.begin();
+ it != defList.end();
+ ++it)
+ {
+ if (this->StartsWith(*it, "-D"))
+ {
+ this->MocDefinitions.push_back(*it);
+ }
+ }
+ }
+
+ std::vector<std::string> incPaths;
+ cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths);
+
+ std::set<std::string> frameworkPaths;
+ for(std::vector<std::string>::const_iterator it = incPaths.begin();
+ it != incPaths.end();
+ ++it)
+ {
+ const std::string &path = *it;
+ this->MocIncludes.push_back("-I" + path);
+ if (this->EndsWith(path, ".framework/Headers"))
+ {
+ // Go up twice to get to the framework root
+ std::vector<std::string> pathComponents;
+ cmsys::SystemTools::SplitPath(path.c_str(), pathComponents);
+ std::string frameworkPath =cmsys::SystemTools::JoinPath(
+ pathComponents.begin(), pathComponents.end() - 2);
+ frameworkPaths.insert(frameworkPath);
+ }
+ }
+
+ for (std::set<std::string>::const_iterator it = frameworkPaths.begin();
+ it != frameworkPaths.end(); ++it)
+ {
+ this->MocIncludes.push_back("-F");
+ this->MocIncludes.push_back(*it);
+ }
+
+
+ if (this->IncludeProjectDirsBefore)
+ {
+ const std::string &binDir = "-I" + this->ProjectBinaryDir;
+
+ const std::string srcDir = "-I" + this->ProjectSourceDir;
+
+ std::list<std::string> sortedMocIncludes;
+ std::list<std::string>::iterator it = this->MocIncludes.begin();
+ while (it != this->MocIncludes.end())
+ {
+ if (this->StartsWith(*it, binDir))
+ {
+ sortedMocIncludes.push_back(*it);
+ it = this->MocIncludes.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ it = this->MocIncludes.begin();
+ while (it != this->MocIncludes.end())
+ {
+ if (this->StartsWith(*it, srcDir))
+ {
+ sortedMocIncludes.push_back(*it);
+ it = this->MocIncludes.erase(it);
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ sortedMocIncludes.insert(sortedMocIncludes.end(),
+ this->MocIncludes.begin(), this->MocIncludes.end());
+ this->MocIncludes = sortedMocIncludes;
+ }
+
+}
+
+
+bool cmQtAutomoc::RunAutomocQt4()
+{
+ if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
+ || (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
+ {
+ this->GenerateAll = true;
+ }
+
+ // the program goes through all .cpp files to see which moc files are
+ // included. It is not really interesting how the moc file is named, but
+ // what file the moc is created from. Once a moc is included the same moc
+ // may not be included in the _automoc.cpp file anymore. OTOH if there's a
+ // header containing Q_OBJECT where no corresponding moc file is included
+ // anywhere a moc_<filename>.cpp file is created and included in
+ // the _automoc.cpp file.
+
+ // key = moc source filepath, value = moc output filepath
+ std::map<std::string, std::string> includedMocs;
+ // key = moc source filepath, value = moc output filename
+ std::map<std::string, std::string> notIncludedMocs;
+
+
+ std::vector<std::string> sourceFiles;
+ cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
+
+ for (std::vector<std::string>::const_iterator it = sourceFiles.begin();
+ it != sourceFiles.end();
+ ++it)
+ {
+ const std::string &absFilename = *it;
+ if (this->Verbose)
+ {
+ std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
+ }
+ this->ParseCppFile(absFilename, includedMocs, notIncludedMocs);
+ }
+
+ std::vector<std::string> headerFiles;
+ cmSystemTools::ExpandListArgument(this->Headers, headerFiles);
+ for (std::vector<std::string>::const_iterator it = headerFiles.begin();
+ it != headerFiles.end();
+ ++it)
+ {
+ const std::string &absFilename = *it;
+ if (this->Verbose)
+ {
+ std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
+ }
+ if (includedMocs.find(absFilename) == includedMocs.end()
+ && notIncludedMocs.find(absFilename) == notIncludedMocs.end())
+ {
+ // if this header is not getting processed yet and is explicitly
+ // mentioned for the automoc the moc is run unconditionally on the
+ // header and the resulting file is included in the _automoc.cpp file
+ // (unless there's a .cpp file later on that includes the moc from
+ // this header)
+ const std::string currentMoc = "moc_" + cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFilename) + ".cpp";
+ notIncludedMocs[absFilename] = currentMoc;
+ }
+ }
+
+ // run moc on all the moc's that are #included in source files
+ for(std::map<std::string, std::string>::const_iterator
+ it = includedMocs.begin();
+ it != includedMocs.end();
+ ++it)
+ {
+ this->GenerateMoc(it->first, it->second);
+ }
+
+ std::stringstream outStream(std::stringstream::out);
+ outStream << "/* This file is autogenerated, do not edit*/\n";
+
+ bool automocCppChanged = false;
+ if (notIncludedMocs.empty())
+ {
+ outStream << "enum some_compilers { need_more_than_nothing };\n";
+ }
+ else
+ {
+ // run moc on the remaining headers and include them in
+ // the _automoc.cpp file
+ for(std::map<std::string, std::string>::const_iterator
+ it = notIncludedMocs.begin();
+ it != notIncludedMocs.end();
+ ++it)
+ {
+ bool mocSuccess = this->GenerateMoc(it->first, it->second);
+ if (mocSuccess)
+ {
+ automocCppChanged = true;
+ }
+ outStream << "#include \"" << it->second << "\"\n";
+ }
+ }
+
+ if (this->RunMocFailed)
+ {
+ std::cerr << "returning failed.."<< std::endl;
+ return false;
+ }
+ outStream.flush();
+ std::string automocSource = outStream.str();
+ if (!automocCppChanged)
+ {
+ // compare contents of the _automoc.cpp file
+ const std::string oldContents = this->ReadAll(this->OutMocCppFilename);
+ if (oldContents == automocSource)
+ {
+ // nothing changed: don't touch the _automoc.cpp file
+ return true;
+ }
+ }
+
+ // source file that includes all remaining moc files (_automoc.cpp file)
+ std::fstream outfile;
+ outfile.open(this->OutMocCppFilename.c_str(),
+ std::ios::out | std::ios::trunc);
+ outfile << automocSource;
+ outfile.close();
+
+ return true;
+}
+
+
+void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
+ std::map<std::string, std::string>& includedMocs,
+ std::map<std::string, std::string>& notIncludedMocs)
+{
+ cmsys::RegularExpression mocIncludeRegExp(
+ "[\n][ \t]*#[ \t]*include[ \t]+"
+ "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
+ cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ std::list<std::string> headerExtensions;
+ headerExtensions.push_back(".h");
+ headerExtensions.push_back(".hpp");
+ headerExtensions.push_back(".hxx");
+#if defined(_WIN32)
+ // not case sensitive, don't add ".H"
+#elif defined(__APPLE__)
+ // detect case-sensitive filesystem
+ long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
+ if (caseSensitive == 1)
+ {
+ headerExtensions.push_back(".H");
+ }
+#else
+ headerExtensions.push_back(".H");
+#endif
+
+ const std::string contentsString = this->ReadAll(absFilename);
+ if (contentsString.empty())
+ {
+ std::cerr << "AUTOMOC: empty source file: " << absFilename << std::endl;
+ return;
+ }
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+
+ std::string::size_type matchOffset = 0;
+ if (!mocIncludeRegExp.find(contentsString.c_str()))
+ {
+ // no moc #include, look whether we need to create a moc from
+ // the .h nevertheless
+ const std::string basename =
+ cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string headername = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(headername.c_str())
+ && includedMocs.find(headername) == includedMocs.end()
+ && notIncludedMocs.find(headername) == notIncludedMocs.end())
+ {
+ const std::string currentMoc = "moc_" + basename + ".cpp";
+ const std::string contents = this->ReadAll(headername);
+ if (qObjectRegExp.find(contents))
+ {
+ //std::cout << "header contains Q_OBJECT macro";
+ notIncludedMocs[headername] = currentMoc;
+ }
+ break;
+ }
+ }
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string privateHeaderName = absPath+basename+"_p"+(*ext);
+ if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())
+ && includedMocs.find(privateHeaderName) == includedMocs.end()
+ && notIncludedMocs.find(privateHeaderName) == notIncludedMocs.end())
+ {
+ const std::string currentMoc = "moc_" + basename + "_p.cpp";
+ const std::string contents = this->ReadAll(privateHeaderName);
+ if (qObjectRegExp.find(contents))
+ {
+ //std::cout << "header contains Q_OBJECT macro";
+ notIncludedMocs[privateHeaderName] = currentMoc;
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ // for every moc include in the file
+ do
+ {
+ const std::string currentMoc = mocIncludeRegExp.match(1);
+ //std::cout << "found moc include: " << currentMoc << std::endl;
+
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(currentMoc);
+ const bool moc_style = this->StartsWith(basename, "moc_");
+
+ // If the moc include is of the moc_foo.cpp style we expect
+ // the Q_OBJECT class declaration in a header file.
+ // If the moc include is of the foo.moc style we need to look for
+ // a Q_OBJECT macro in the current source file, if it contains the
+ // macro we generate the moc file from the source file, else from the
+ // header.
+ // Q_OBJECT
+ if (moc_style || !qObjectRegExp.find(contentsString))
+ {
+ if (moc_style)
+ {
+ // basename should be the part of the moc filename used for
+ // finding the correct header, so we need to remove the moc_ part
+ basename = basename.substr(4);
+ }
+
+ bool headerFound = false;
+ for(std::list<std::string>::const_iterator ext =
+ headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string &sourceFilePath = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ headerFound = true;
+ includedMocs[sourceFilePath] = currentMoc;
+ notIncludedMocs.erase(sourceFilePath);
+ break;
+ }
+ }
+ if (!headerFound)
+ {
+ // the moc file is in a subdir => look for the header in the
+ // same subdir
+ if (currentMoc.find_first_of('/') != std::string::npos)
+ {
+ const std::string &filepath = absPath
+ + cmsys::SystemTools::GetFilenamePath(currentMoc)
+ + '/' + basename;
+
+ for(std::list<std::string>::const_iterator ext =
+ headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ const std::string &sourceFilePath = filepath + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ headerFound = true;
+ includedMocs[sourceFilePath] = currentMoc;
+ notIncludedMocs.erase(sourceFilePath);
+ break;
+ }
+ }
+ if (!headerFound)
+ {
+ std::cerr << "AUTOMOC: The file \"" << absFilename
+ << "\" includes the moc file \"" << currentMoc
+ << "\", but neither \"" << absPath << basename
+ << '{' << this->Join(headerExtensions, ',')
+ << "}\" nor \"" << filepath << '{'
+ << this->Join(headerExtensions, ',') << '}'
+ << "\" exist." << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ }
+ else
+ {
+ std::cerr << "AUTOMOC: The file \"" << absFilename
+ << "\" includes the moc file \"" << currentMoc
+ << "\", but \"" << absPath << basename << '{'
+ << this->Join(headerExtensions, ',') << '}'
+ << "\" does not exist." << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ }
+ }
+ else
+ {
+ includedMocs[absFilename] = currentMoc;
+ notIncludedMocs.erase(absFilename);
+ }
+ matchOffset += mocIncludeRegExp.end();
+ } while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
+ }
+}
+
+
+bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
+ const std::string& mocFileName)
+{
+ const std::string mocFilePath = this->Builddir + mocFileName;
+ int sourceNewerThanMoc = 0;
+ bool success = cmsys::SystemTools::FileTimeCompare(sourceFile.c_str(),
+ mocFilePath.c_str(),
+ &sourceNewerThanMoc);
+ if (this->GenerateAll || !success || sourceNewerThanMoc >= 0)
+ {
+ // make sure the directory for the resulting moc file exists
+ std::string mocDir = mocFilePath.substr(0, mocFilePath.rfind('/'));
+ if (!cmsys::SystemTools::FileExists(mocDir.c_str(), false))
+ {
+ cmsys::SystemTools::MakeDirectory(mocDir.c_str());
+ }
+
+ std::string msg = "Generating ";
+ msg += mocFileName;
+ cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
+ |cmsysTerminal_Color_ForegroundBold,
+ msg.c_str(), true, this->ColorOutput);
+
+ std::vector<cmStdString> command;
+ command.push_back(this->MocExecutable);
+ for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
+ it != this->MocIncludes.end();
+ ++it)
+ {
+ command.push_back(*it);
+ }
+ for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
+ it != this->MocDefinitions.end();
+ ++it)
+ {
+ command.push_back(*it);
+ }
+#ifdef _WIN32
+ command.push_back("-DWIN32");
+#endif
+ command.push_back("-o");
+ command.push_back(mocFilePath);
+ command.push_back(sourceFile);
+
+ if (this->Verbose)
+ {
+ for(std::vector<cmStdString>::const_iterator cmdIt = command.begin();
+ cmdIt != command.end();
+ ++cmdIt)
+ {
+ std::cout << *cmdIt << " ";
+ }
+ std::cout << std::endl;
+ }
+
+ std::string output;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal);
+ if (!result || retVal)
+ {
+ std::cerr << "AUTOMOC: process for " << mocFilePath << " failed:\n"
+ << output << std::endl;
+ this->RunMocFailed = true;
+ cmSystemTools::RemoveFile(mocFilePath.c_str());
+ }
+ return true;
+ }
+ return false;
+}
+
+
+std::string cmQtAutomoc::Join(const std::list<std::string>& lst,char separator)
+{
+ if (lst.empty())
+ {
+ return "";
+ }
+
+ std::string result;
+ for (std::list<std::string>::const_iterator it = lst.begin();
+ it != lst.end();
+ ++it)
+ {
+ result += (*it) + separator;
+ }
+ result.erase(result.end() - 1);
+ return result;
+}
+
+
+bool cmQtAutomoc::StartsWith(const std::string& str, const std::string& with)
+{
+ return (str.substr(0, with.length()) == with);
+}
+
+
+bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
+{
+ if (with.length() > (str.length()))
+ {
+ return false;
+ }
+ return (str.substr(str.length() - with.length(), with.length()) == with);
+}
+
+
+std::string cmQtAutomoc::ReadAll(const std::string& filename)
+{
+ std::ifstream file(filename.c_str());
+ std::stringstream stream;
+ stream << file.rdbuf();
+ file.close();
+ return stream.str();
+}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
new file mode 100644
index 0000000..4fd9041
--- /dev/null
+++ b/Source/cmQtAutomoc.h
@@ -0,0 +1,66 @@
+#ifndef cmQtAutomoc_h
+#define cmQtAutomoc_h
+
+class cmGlobalGenerator;
+class cmMakefile;
+
+class cmQtAutomoc
+{
+public:
+ cmQtAutomoc();
+ bool Run(const char* targetDirectory);
+
+ void SetupAutomocTarget(cmTarget* target);
+
+private:
+ cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory);
+
+ bool ReadAutomocInfoFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
+ const char* targetDirectory);
+ void WriteOldMocDefinitionsFile(const char* targetDirectory);
+
+ bool RunAutomocQt4();
+ bool GenerateMoc(const std::string& sourceFile,
+ const std::string& mocFileName);
+ void ParseCppFile(const std::string& absFilename,
+ std::map<std::string, std::string>& includedMocs,
+ std::map<std::string, std::string>& notIncludedMocs);
+
+ void Init();
+
+ std::string Join(const std::list<std::string>& lst, char separator);
+ bool EndsWith(const std::string& str, const std::string& with);
+ bool StartsWith(const std::string& str, const std::string& with);
+ std::string ReadAll(const std::string& filename);
+
+ std::string QtMajorVersion;
+ std::string Sources;
+ std::string Headers;
+ bool IncludeProjectDirsBefore;
+ std::string Srcdir;
+ std::string Builddir;
+ std::string MocExecutable;
+ std::string MocCompileDefinitionsStr;
+ std::string MocDefinitionsStr;
+ std::string MocIncludesStr;
+ std::string ProjectBinaryDir;
+ std::string ProjectSourceDir;
+ std::string TargetName;
+
+ std::string OldMocDefinitionsStr;
+
+ std::string OutMocCppFilename;
+ std::list<std::string> MocIncludes;
+ std::list<std::string> MocDefinitions;
+
+ bool Verbose;
+ bool ColorOutput;
+ bool RunMocFailed;
+ bool GenerateAll;
+
+};
+
+#endif
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 87c416f..bae2ee1 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmRemoveCommand
- * \brief Set a CMAKE variable
+ * \brief remove command
*
- * cmRemoveCommand sets a variable to a value with expansion.
+ * cmRemoveCommand implements the remove CMake command
*/
class cmRemoveCommand : public cmCommand
{
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 10b3c40..736f066 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmSeparateArgumentsCommand
- * \brief SeparateArguments a CMAKE variable
+ * \brief separate_arguments command
*
- * cmSeparateArgumentsCommand sets a variable to a value with expansion.
+ * cmSeparateArgumentsCommand implements the separate_arguments CMake command
*/
class cmSeparateArgumentsCommand : public cmCommand
{
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 3a4773c..cc10840 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -20,6 +20,7 @@
cmSetPropertyCommand::cmSetPropertyCommand()
{
this->AppendMode = false;
+ this->AppendAsString = false;
this->Remove = true;
}
@@ -83,6 +84,13 @@ bool cmSetPropertyCommand
{
doing = DoingNone;
this->AppendMode = true;
+ this->AppendAsString = false;
+ }
+ else if(*arg == "APPEND_STRING")
+ {
+ doing = DoingNone;
+ this->AppendMode = true;
+ this->AppendAsString = true;
}
else if(doing == DoingNames)
{
@@ -152,7 +160,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
}
if(this->AppendMode)
{
- cm->AppendProperty(name, value);
+ cm->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -218,7 +226,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
}
if(this->AppendMode)
{
- mf->AppendProperty(name, value);
+ mf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -266,7 +274,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
}
if(this->AppendMode)
{
- target->AppendProperty(name, value);
+ target->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -317,7 +325,7 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
if(this->AppendMode)
{
- sf->AppendProperty(name, value);
+ sf->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -377,7 +385,7 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
}
if(this->AppendMode)
{
- test->AppendProperty(name, value);
+ test->AppendProperty(name, value, this->AppendAsString);
}
else
{
@@ -464,7 +472,7 @@ bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
}
if(this->AppendMode)
{
- it.AppendProperty(name, value);
+ it.AppendProperty(name, value, this->AppendAsString);
}
else
{
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index c477bb7..3a0169e 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -56,7 +56,7 @@ public:
" SOURCE [src1 [src2 ...]] |\n"
" TEST [test1 [test2 ...]] |\n"
" CACHE [entry1 [entry2 ...]]>\n"
- " [APPEND]\n"
+ " [APPEND] [APPEND_STRING]\n"
" PROPERTY <name> [value1 [value2 ...]])\n"
"Set one property on zero or more objects of a scope. "
"The first argument determines the scope in which the property "
@@ -77,6 +77,9 @@ public:
"list. "
"If the APPEND option is given the list is appended to any "
"existing property value."
+ "If the APPEND_STRING option is given the string is append to any "
+ "existing property value as string, i.e. it results in a longer "
+ "string and not a list of strings."
;
}
@@ -93,6 +96,7 @@ private:
std::string PropertyValue;
bool Remove;
bool AppendMode;
+ bool AppendAsString;
// Implementation of each property type.
bool HandleGlobalMode();
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index 9e39401..feead00 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -143,6 +143,10 @@ public:
"VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set "
"to add support for source control bindings in a Visual Studio "
"project file.\n"
+ "VS_GLOBAL_<variable> can be set to add a Visual Studio "
+ "project-specific global variable. "
+ "Qt integration works better if VS_GLOBAL_QtVersion is set to "
+ "the Qt version FindQt4.cmake found. For example, \"4.7.3\"\n"
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
"old way to specify CMake scripts to run before and after "
"installing a target. They are used only when the old "
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 7b80c5c..04e357c 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -63,7 +63,7 @@ bool cmSiteNameCommand
{
std::string host;
cmSystemTools::RunSingleCommand(hostname_cmd.c_str(),
- &host, 0, 0, false);
+ &host, 0, 0, cmSystemTools::OUTPUT_NONE);
// got the hostname
if (host.length())
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index 6357569..ac7f426 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -15,9 +15,9 @@
#include "cmCommand.h"
/** \class cmSiteNameCommand
- * \brief SiteName a CMAKE variable
+ * \brief site_name command
*
- * cmSiteNameCommand sets a variable to a value with expansion.
+ * cmSiteNameCommand implements the site_name CMake command
*/
class cmSiteNameCommand : public cmCommand
{
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 42d3f06..dfa2c0b 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -291,13 +291,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmSourceFile::AppendProperty(const char* prop, const char* value)
+void cmSourceFile::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE);
+ this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
+ asString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 2dc8488..55147e1 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -44,7 +44,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index dbb2226..03364bd 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -12,7 +12,7 @@
#if defined(_MSC_VER) && _MSC_VER < 1300
# define _WIN32_WINNT 0x0400 /* for wincrypt.h */
#endif
-#include "cmSystemTools.h"
+#include "cmSystemTools.h"
#include <ctype.h>
#include <errno.h>
#include <time.h>
@@ -126,7 +126,7 @@ const char* cmSystemTools::GetWindows9xComspecSubstitute()
return cmSystemTools::s_Windows9xComspecSubstitute.c_str();
}
-void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
+void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
bool&, void*);
void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*);
void* cmSystemTools::s_ErrorCallbackClientData = 0;
@@ -144,7 +144,7 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64 view)
// a close square-bracket. The ']' character must be the first in the
// list of characters inside the [^...] block of the expression.
cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]");
-
+
// check for black line or comment
while (regEntry.find(source))
{
@@ -237,7 +237,7 @@ void cmSystemTools::Stdout(const char* s)
{
if(s_StdoutCallback)
{
- (*s_StdoutCallback)(s, static_cast<int>(strlen(s)),
+ (*s_StdoutCallback)(s, static_cast<int>(strlen(s)),
s_StdoutCallbackClientData);
}
else
@@ -247,6 +247,12 @@ void cmSystemTools::Stdout(const char* s)
}
}
+void cmSystemTools::Stderr(const char* s, int length)
+{
+ std::cerr.write(s, length);
+ std::cerr.flush();
+}
+
void cmSystemTools::Stdout(const char* s, int length)
{
if(s_StdoutCallback)
@@ -268,7 +274,7 @@ void cmSystemTools::Message(const char* m1, const char *title)
}
if(s_ErrorCallback)
{
- (*s_ErrorCallback)(m1, title, s_DisableMessages,
+ (*s_ErrorCallback)(m1, title, s_DisableMessages,
s_ErrorCallbackClientData);
return;
}
@@ -276,7 +282,7 @@ void cmSystemTools::Message(const char* m1, const char *title)
{
std::cerr << m1 << std::endl << std::flush;
}
-
+
}
@@ -311,7 +317,7 @@ bool cmSystemTools::IsOn(const char* val)
return false;
}
std::basic_string<char> v = val;
-
+
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
@@ -344,13 +350,13 @@ bool cmSystemTools::IsOff(const char* val)
return true;
}
std::basic_string<char> v = val;
-
+
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
- return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
+ return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE");
}
@@ -569,15 +575,15 @@ std::vector<cmStdString> cmSystemTools::ParseArguments(const char* command)
args.push_back(arg);
}
}
-
+
return args;
}
bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
std::string* output ,
- int* retVal , const char* dir ,
- bool verbose ,
+ int* retVal , const char* dir ,
+ OutputOption outputflag ,
double timeout )
{
std::vector<const char*> argv;
@@ -599,46 +605,62 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
{
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
+
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
-
+
std::vector<char> tempOutput;
char* data;
int length;
- if ( output || verbose )
- {
- while(cmsysProcess_WaitForData(cp, &data, &length, 0))
+ int pipe;
+ if ( output || outputflag != OUTPUT_NONE )
{
- if(output || verbose)
+ while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0)
{
- // Translate NULL characters in the output into valid text.
- // Visual Studio 7 puts these characters in the output of its
- // build process.
- for(int i=0; i < length; ++i)
+ if(output || outputflag != OUTPUT_NONE)
{
- if(data[i] == '\0')
+ // Translate NULL characters in the output into valid text.
+ // Visual Studio 7 puts these characters in the output of its
+ // build process.
+ for(int i=0; i < length; ++i)
{
- data[i] = ' ';
+ if(data[i] == '\0')
+ {
+ data[i] = ' ';
+ }
+ }
+ }
+ if ( output )
+ {
+ tempOutput.insert(tempOutput.end(), data, data+length);
+ }
+ if(outputflag != OUTPUT_NONE)
+ {
+ if(outputflag == OUTPUT_MERGE)
+ {
+ cmSystemTools::Stdout(data, length);
+ }
+ else
+ {
+ if(pipe == cmsysProcess_Pipe_STDERR)
+ {
+ cmSystemTools::Stderr(data, length);
+ }
+ else if(pipe == cmsysProcess_Pipe_STDOUT)
+ {
+ cmSystemTools::Stdout(data, length);
+ }
}
}
- }
- if ( output )
- {
- tempOutput.insert(tempOutput.end(), data, data+length);
- }
- if(verbose)
- {
- cmSystemTools::Stdout(data, length);
}
}
- }
-
+
cmsysProcess_WaitForExit(cp, 0);
if ( output && tempOutput.begin() != tempOutput.end())
{
output->append(&*tempOutput.begin(), tempOutput.size());
}
-
+
bool result = true;
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
{
@@ -657,7 +679,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exception)
{
const char* exception_str = cmsysProcess_GetExceptionString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << exception_str << std::endl;
}
@@ -670,7 +692,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{
const char* error_str = cmsysProcess_GetErrorString(cp);
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -683,7 +705,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
else if(cmsysProcess_GetState(cp) == cmsysProcess_State_Expired)
{
const char* error_str = "Process terminated due to timeout\n";
- if ( verbose )
+ if ( outputflag != OUTPUT_NONE )
{
std::cerr << error_str << std::endl;
}
@@ -693,22 +715,22 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
}
result = false;
}
-
+
cmsysProcess_Delete(cp);
return result;
}
bool cmSystemTools::RunSingleCommand(
- const char* command,
+ const char* command,
std::string* output,
- int *retVal,
+ int *retVal,
const char* dir,
- bool verbose,
+ OutputOption outputflag,
double timeout)
{
if(s_DisableRunCommandOutput)
{
- verbose = false;
+ outputflag = OUTPUT_NONE;
}
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -717,17 +739,17 @@ bool cmSystemTools::RunSingleCommand(
{
return false;
}
- return cmSystemTools::RunSingleCommand(args, output,retVal,
- dir, verbose, timeout);
+ return cmSystemTools::RunSingleCommand(args, output,retVal,
+ dir, outputflag, timeout);
}
-bool cmSystemTools::RunCommand(const char* command,
+bool cmSystemTools::RunCommand(const char* command,
std::string& output,
const char* dir,
bool verbose,
int timeout)
{
int dummy;
- return cmSystemTools::RunCommand(command, output, dummy,
+ return cmSystemTools::RunCommand(command, output, dummy,
dir, verbose, timeout);
}
@@ -742,11 +764,11 @@ bool RunCommandViaWin32(const char* command,
int timeout)
{
#if defined(__BORLANDC__)
- return
+ return
cmWin32ProcessExecution::
- BorlandRunCommand(command, dir, output,
- retVal,
- verbose, timeout,
+ BorlandRunCommand(command, dir, output,
+ retVal,
+ verbose, timeout,
cmSystemTools::GetRunCommandHideConsole());
#else // Visual studio
::SetLastError(ERROR_SUCCESS);
@@ -760,7 +782,7 @@ bool RunCommandViaWin32(const char* command,
{
resProc.SetHideWindows(true);
}
-
+
if ( cmSystemTools::GetWindows9xComspecSubstitute() )
{
resProc.SetConsoleSpawn(cmSystemTools::GetWindows9xComspecSubstitute() );
@@ -787,7 +809,7 @@ bool RunCommandViaSystem(const char* command,
std::string& output,
int& retVal,
bool verbose)
-{
+{
std::cout << "@@ " << command << std::endl;
std::string commandInDir;
@@ -987,9 +1009,9 @@ bool RunCommandViaPopen(const char* command,
// run a command unix uses popen (easy)
// windows uses system and ShortPath
-bool cmSystemTools::RunCommand(const char* command,
+bool cmSystemTools::RunCommand(const char* command,
std::string& output,
- int &retVal,
+ int &retVal,
const char* dir,
bool verbose,
int timeout)
@@ -998,7 +1020,7 @@ bool cmSystemTools::RunCommand(const char* command,
{
verbose = false;
}
-
+
#if defined(WIN32) && !defined(__CYGWIN__)
// if the command does not start with a quote, then
// try to find the program, and if the program can not be
@@ -1017,9 +1039,9 @@ bool cmSystemTools::RunCommand(const char* command,
{
break;
}
- }
+ }
}
- // if there are more than two double quotes use
+ // if there are more than two double quotes use
// GetShortPathName, the cmd.exe program in windows which
// is used by system fails to execute if there are more than
// one set of quotes in the arguments
@@ -1043,16 +1065,16 @@ bool cmSystemTools::RunCommand(const char* command,
shortCmd += " ";
shortCmd += args;
- //return RunCommandViaSystem(shortCmd.c_str(), dir,
+ //return RunCommandViaSystem(shortCmd.c_str(), dir,
// output, retVal, verbose);
- //return WindowsRunCommand(shortCmd.c_str(), dir,
+ //return WindowsRunCommand(shortCmd.c_str(), dir,
//output, retVal, verbose);
- return RunCommandViaWin32(shortCmd.c_str(), dir,
+ return RunCommandViaWin32(shortCmd.c_str(), dir,
output, retVal, verbose, timeout);
}
else
{
- cmSystemTools::Error("Could not parse command line with quotes ",
+ cmSystemTools::Error("Could not parse command line with quotes ",
command);
}
}
@@ -1116,7 +1138,7 @@ bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
return Superclass::CopyFileAlways(source, destination);
}
-bool cmSystemTools::CopyFileIfDifferent(const char* source,
+bool cmSystemTools::CopyFileIfDifferent(const char* source,
const char* destination)
{
return Superclass::CopyFileIfDifferent(source, destination);
@@ -1247,7 +1269,7 @@ void cmSystemTools::Glob(const char *directory, const char *regexp,
{
cmsys::Directory d;
cmsys::RegularExpression reg(regexp);
-
+
if (d.Load(directory))
{
size_t numf;
@@ -1300,7 +1322,7 @@ void cmSystemTools::GlobDirs(const char *fullPath,
}
-void cmSystemTools::ExpandList(std::vector<std::string> const& arguments,
+void cmSystemTools::ExpandList(std::vector<std::string> const& arguments,
std::vector<std::string>& newargs)
{
std::vector<std::string>::const_iterator i;
@@ -1399,8 +1421,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
}
}
-bool cmSystemTools::SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+bool cmSystemTools::SimpleGlob(const cmStdString& glob,
+ std::vector<cmStdString>& files,
int type /* = 0 */)
{
files.clear();
@@ -1440,8 +1462,8 @@ bool cmSystemTools::SimpleGlob(const cmStdString& glob,
{
continue;
}
- if ( sfname.size() >= ppath.size() &&
- sfname.substr(0, ppath.size()) ==
+ if ( sfname.size() >= ppath.size() &&
+ sfname.substr(0, ppath.size()) ==
ppath )
{
files.push_back(fname);
@@ -1461,10 +1483,10 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
}
//std::string ext = cmSystemTools::LowerCase(cext);
std::string ext = cext;
- if ( ext == "c" || ext == ".c" ||
- ext == "m" || ext == ".m"
+ if ( ext == "c" || ext == ".c" ||
+ ext == "m" || ext == ".m"
) { return cmSystemTools::C_FILE_FORMAT; }
- if (
+ if (
ext == "C" || ext == ".C" ||
ext == "M" || ext == ".M" ||
ext == "c++" || ext == ".c++" ||
@@ -1473,22 +1495,22 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
ext == "cxx" || ext == ".cxx" ||
ext == "mm" || ext == ".mm"
) { return cmSystemTools::CXX_FILE_FORMAT; }
- if (
+ if (
ext == "f" || ext == ".f" ||
ext == "F" || ext == ".F" ||
ext == "f77" || ext == ".f77" ||
ext == "f90" || ext == ".f90" ||
ext == "for" || ext == ".for" ||
- ext == "f95" || ext == ".f95"
+ ext == "f95" || ext == ".f95"
) { return cmSystemTools::FORTRAN_FILE_FORMAT; }
if ( ext == "java" || ext == ".java" )
{ return cmSystemTools::JAVA_FILE_FORMAT; }
- if (
- ext == "H" || ext == ".H" ||
- ext == "h" || ext == ".h" ||
+ if (
+ ext == "H" || ext == ".H" ||
+ ext == "h" || ext == ".h" ||
ext == "h++" || ext == ".h++" ||
- ext == "hm" || ext == ".hm" ||
- ext == "hpp" || ext == ".hpp" ||
+ ext == "hm" || ext == ".hm" ||
+ ext == "hpp" || ext == ".hpp" ||
ext == "hxx" || ext == ".hxx" ||
ext == "in" || ext == ".in" ||
ext == "txx" || ext == ".txx"
@@ -1501,18 +1523,18 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
ext == "a" || ext == ".a")
{ return cmSystemTools::STATIC_LIBRARY_FILE_FORMAT; }
if ( ext == "o" || ext == ".o" ||
- ext == "obj" || ext == ".obj")
+ ext == "obj" || ext == ".obj")
{ return cmSystemTools::OBJECT_FILE_FORMAT; }
#ifdef __APPLE__
- if ( ext == "dylib" || ext == ".dylib" )
+ if ( ext == "dylib" || ext == ".dylib" )
{ return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; }
- if ( ext == "so" || ext == ".so" ||
- ext == "bundle" || ext == ".bundle" )
- { return cmSystemTools::MODULE_FILE_FORMAT; }
+ if ( ext == "so" || ext == ".so" ||
+ ext == "bundle" || ext == ".bundle" )
+ { return cmSystemTools::MODULE_FILE_FORMAT; }
#else // __APPLE__
- if ( ext == "so" || ext == ".so" ||
- ext == "sl" || ext == ".sl" ||
- ext == "dll" || ext == ".dll" )
+ if ( ext == "so" || ext == ".so" ||
+ ext == "sl" || ext == ".sl" ||
+ ext == "dll" || ext == ".dll" )
{ return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; }
#endif // __APPLE__
return cmSystemTools::UNKNOWN_FILE_FORMAT;
@@ -1708,7 +1730,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
return false;
}
-bool cmSystemTools::CreateTar(const char* outFileName,
+bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<cmStdString>& files,
bool gzip, bool bzip2, bool verbose)
{
@@ -1773,7 +1795,7 @@ namespace{
static time_t now;
size_t u_width = 6;
size_t gs_width = 13;
-
+
/*
* We avoid collecting the entire list in memory at once by
* listing things as we see them. However, that also means we can't
@@ -1788,7 +1810,7 @@ namespace{
fprintf(out, "%s %d ",
archive_entry_strmode(entry),
archive_entry_nlink(entry));
-
+
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
if ((p == NULL) || (*p == '\0'))
@@ -1809,7 +1831,7 @@ namespace{
{
fprintf(out, "%s", p);
w = strlen(p);
- }
+ }
else
{
sprintf(tmp, "%lu",
@@ -1817,20 +1839,20 @@ namespace{
w = strlen(tmp);
fprintf(out, "%s", tmp);
}
-
+
/*
* Print device number or file size, right-aligned so as to make
* total width of group and devnum/filesize fields be gs_width.
* If gs_width is too small, grow it.
*/
if (archive_entry_filetype(entry) == AE_IFCHR
- || archive_entry_filetype(entry) == AE_IFBLK)
+ || archive_entry_filetype(entry) == AE_IFBLK)
{
sprintf(tmp, "%lu,%lu",
(unsigned long)archive_entry_rdevmajor(entry),
(unsigned long)archive_entry_rdevminor(entry));
}
- else
+ else
{
/*
* Note the use of platform-dependent macros to format
@@ -1851,7 +1873,7 @@ namespace{
#define HALF_YEAR (time_t)365 * 86400 / 2
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows' strftime function does not support %e format. */
-#define DAY_FMT "%d"
+#define DAY_FMT "%d"
#else
#define DAY_FMT "%e" /* Day number without leading zeros */
#endif
@@ -1881,15 +1903,15 @@ namespace{
#ifdef __BORLANDC__
# pragma warn -8066 /* unreachable code */
#endif
-
+
long copy_data(struct archive *ar, struct archive *aw)
{
long r;
const void *buff;
size_t size;
off_t offset;
-
- for (;;)
+
+ for (;;)
{
r = archive_read_data_block(ar, &buff, &size, &offset);
if (r == ARCHIVE_EOF)
@@ -1901,7 +1923,7 @@ long copy_data(struct archive *ar, struct archive *aw)
return (r);
}
r = archive_write_data_block(aw, buff, size, offset);
- if (r != ARCHIVE_OK)
+ if (r != ARCHIVE_OK)
{
cmSystemTools::Message("archive_write_data_block()",
archive_error_string(aw));
@@ -1911,7 +1933,7 @@ long copy_data(struct archive *ar, struct archive *aw)
return r;
}
-bool extract_tar(const char* outFileName, bool verbose,
+bool extract_tar(const char* outFileName, bool verbose,
bool extract)
{
struct archive* a = archive_read_new();
@@ -1921,12 +1943,12 @@ bool extract_tar(const char* outFileName, bool verbose,
struct archive_entry *entry;
int r = archive_read_open_file(a, outFileName, 10240);
if(r)
- {
+ {
cmSystemTools::Error("Problem with archive_read_open_file(): ",
archive_error_string(a));
return false;
}
- for (;;)
+ for (;;)
{
r = archive_read_next_header(a, &entry);
if (r == ARCHIVE_EOF)
@@ -1969,7 +1991,7 @@ bool extract_tar(const char* outFileName, bool verbose,
cmSystemTools::Error("Current file:",
archive_entry_pathname(entry));
}
- else
+ else
{
copy_data(a, ext);
r = archive_write_finish_entry(ext);
@@ -1991,9 +2013,9 @@ bool extract_tar(const char* outFileName, bool verbose,
}
}
-#endif
+#endif
-bool cmSystemTools::ExtractTar(const char* outFileName,
+bool cmSystemTools::ExtractTar(const char* outFileName,
bool , bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2005,7 +2027,7 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
#endif
}
-bool cmSystemTools::ListTar(const char* outFileName,
+bool cmSystemTools::ListTar(const char* outFileName,
bool ,
bool verbose)
{
@@ -2121,8 +2143,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
}
void cmSystemTools::DoNotInheritStdPipes()
-{
-#ifdef _WIN32
+{
+#ifdef _WIN32
// Check to see if we are attached to a console
// if so, then do not stop the inherited pipes
// or stdout and stderr will not show up in dos
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ce49959..641c89f 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -29,9 +29,9 @@ class cmSystemTools: public cmsys::SystemTools
{
public:
typedef cmsys::SystemTools Superclass;
-
+
/** Expand out any arguements in the vector that have ; separated
- * strings into multiple arguements. A new vector is created
+ * strings into multiple arguements. A new vector is created
* containing the expanded versions of all arguments in argsIn.
*/
static void ExpandList(std::vector<std::string> const& argsIn,
@@ -52,7 +52,7 @@ public:
typedef void (*ErrorCallback)(const char*, const char*, bool&, void*);
/**
* Set the function used by GUI's to display error messages
- * Function gets passed: message as a const char*,
+ * Function gets passed: message as a const char*,
* title as a const char*, and a reference to bool that when
* set to false, will disable furthur messages (cancel).
*/
@@ -75,10 +75,13 @@ public:
typedef void (*StdoutCallback)(const char*, int length, void*);
static void SetStdoutCallback(StdoutCallback, void* clientData=0);
+ ///! Send a string to stderr. Stdout callbacks will not be invoced.
+ static void Stderr(const char* s, int length);
+
///! Return true if there was an error at any point.
- static bool GetErrorOccuredFlag()
+ static bool GetErrorOccuredFlag()
{
- return cmSystemTools::s_ErrorOccured ||
+ return cmSystemTools::s_ErrorOccured ||
cmSystemTools::s_FatalErrorOccured;
}
///! If this is set to true, cmake stops processing commands.
@@ -91,7 +94,7 @@ public:
cmSystemTools::s_ErrorOccured = true;
}
///! Return true if there was an error at any point.
- static bool GetFatalErrorOccured()
+ static bool GetFatalErrorOccured()
{
return cmSystemTools::s_FatalErrorOccured;
}
@@ -102,25 +105,25 @@ public:
cmSystemTools::s_FatalErrorOccured = false;
cmSystemTools::s_ErrorOccured = false;
}
-
+
/**
* Does a string indicates that CMake/CPack/CTest internally
* forced this value. This is not the same as On, but this
* may be considered as "internally switched on".
*/
static bool IsInternallyOn(const char* val);
- /**
+ /**
* does a string indicate a true or on value ? This is not the same
- * as ifdef.
- */
+ * as ifdef.
+ */
static bool IsOn(const char* val);
-
- /**
+
+ /**
* does a string indicate a false or off value ? Note that this is
* not the same as !IsOn(...) because there are a number of
* ambiguous values such as "/usr/local/bin" a path will result in
* IsON and IsOff both returning false. Note that the special path
- * NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
+ * NOTFOUND, *-NOTFOUND or IGNORE will cause IsOff to return true.
*/
static bool IsOff(const char* val);
@@ -128,7 +131,7 @@ public:
static bool IsNOTFOUND(const char* value);
///! Return true if the path is a framework
static bool IsPathToFramework(const char* value);
-
+
static bool DoesFileExistWithExtensions(
const char *name,
const std::vector<std::string>& sourceExts);
@@ -154,13 +157,13 @@ public:
* want to find. 0 means all files, -1 means directories, 1 means
* files only. This method returns true if search was succesfull.
*/
- static bool SimpleGlob(const cmStdString& glob,
- std::vector<cmStdString>& files,
+ static bool SimpleGlob(const cmStdString& glob,
+ std::vector<cmStdString>& files,
int type = 0);
-
+
///! Copy a file.
static bool cmCopyFile(const char* source, const char* destination);
- static bool CopyFileIfDifferent(const char* source,
+ static bool CopyFileIfDifferent(const char* source,
const char* destination);
/** Rename a file or directory within a single disk volume (atomic
@@ -184,45 +187,53 @@ public:
* If timeout is specified, the command will be terminated after
* timeout expires.
*/
- static bool RunCommand(const char* command, std::string& output,
+ static bool RunCommand(const char* command, std::string& output,
const char* directory = 0,
bool verbose = true, int timeout = 0);
static bool RunCommand(const char* command, std::string& output,
- int &retVal, const char* directory = 0,
- bool verbose = true, int timeout = 0);
+ int &retVal, const char* directory = 0,
+ bool verbose = true, int timeout = 0);
/**
- * Run a single executable command and put the stdout and stderr
- * in output.
+ * Run a single executable command
*
- * If verbose is false, no user-viewable output from the program
- * being run will be generated.
+ * Output is controlled with outputflag. If outputflag is OUTPUT_NONE, no
+ * user-viewable output from the program being run will be generated.
+ * OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged
+ * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as
+ * it was received.
*
* If timeout is specified, the command will be terminated after
* timeout expires. Timeout is specified in seconds.
*
* Argument retVal should be a pointer to the location where the
- * exit code will be stored. If the retVal is not specified and
- * the program exits with a code other than 0, then the this
+ * exit code will be stored. If the retVal is not specified and
+ * the program exits with a code other than 0, then the this
* function will return false.
*
* If the command has spaces in the path the caller MUST call
* cmSystemTools::ConvertToRunCommandPath on the command before passing
* it into this function or it will not work. The command must be correctly
- * escaped for this to with spaces.
+ * escaped for this to with spaces.
*/
+ enum OutputOption
+ {
+ OUTPUT_NONE = 0,
+ OUTPUT_MERGE,
+ OUTPUT_NORMAL
+ };
static bool RunSingleCommand(const char* command, std::string* output = 0,
- int* retVal = 0, const char* dir = 0,
- bool verbose = true,
+ int* retVal = 0, const char* dir = 0,
+ OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
- /**
+ /**
* In this version of RunSingleCommand, command[0] should be
* the command to run, and each argument to the command should
* be in comand[1]...command[command.size()]
*/
static bool RunSingleCommand(std::vector<cmStdString> const& command,
std::string* output = 0,
- int* retVal = 0, const char* dir = 0,
- bool verbose = true,
+ int* retVal = 0, const char* dir = 0,
+ OutputOption outputflag = OUTPUT_MERGE,
double timeout = 0.0);
/**
@@ -295,7 +306,7 @@ public:
static const char* GetWindows9xComspecSubstitute();
/** Windows if this is true, the CreateProcess in RunCommand will
- * not show new consol windows when running programs.
+ * not show new consol windows when running programs.
*/
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
@@ -303,16 +314,16 @@ public:
* result of strerror(errno)
*/
static void ReportLastSystemError(const char* m);
-
+
/** a general output handler for cmsysProcess */
static int WaitForLine(cmsysProcess* process, std::string& line,
double timeout,
std::vector<char>& out,
std::vector<char>& err);
-
+
/** Split a string on its newlines into multiple lines. Returns
false only if the last line stored had no newline. */
- static bool Split(const char* s, std::vector<cmStdString>& l);
+ static bool Split(const char* s, std::vector<cmStdString>& l);
static void SetForceUnixPaths(bool v)
{
s_ForceUnixPaths = v;
@@ -327,14 +338,14 @@ public:
static void ConvertToOutputSlashes(std::string& path);
// ConvertToRunCommandPath does not use s_ForceUnixPaths and should
- // be used when RunCommand is called from cmake, because the
+ // be used when RunCommand is called from cmake, because the
// running cmake needs paths to be in its format
static std::string ConvertToRunCommandPath(const char* path);
//! Check if the first string ends with the second one.
static bool StringEndsWith(const char* str1, const char* str2);
-
- /** compute the relative path from local to remote. local must
- be a directory. remote can be a file or a directory.
+
+ /** compute the relative path from local to remote. local must
+ be a directory. remote can be a file or a directory.
Both remote and local must be full paths. Basically, if
you are in directory local and you want to access the file in remote
what is the relative path to do that. For example:
@@ -385,7 +396,7 @@ public:
static bool CreateTar(const char* outFileName,
const std::vector<cmStdString>& files, bool gzip,
bool bzip2, bool verbose);
- static bool ExtractTar(const char* inFileName, bool gzip,
+ static bool ExtractTar(const char* inFileName, bool gzip,
bool verbose);
// This should be called first thing in main
// it will keep child processes from inheriting the
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 52b9072..4969b65 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -115,6 +115,28 @@ cmTarget::cmTarget()
void cmTarget::DefineProperties(cmake *cm)
{
cm->DefineProperty
+ ("AUTOMOC", cmProperty::TARGET,
+ "Should the target be processed with automoc (for Qt projects).",
+ "AUTOMOC is a boolean specifying whether CMake will handle "
+ "the Qt moc preprocessor automatically, i.e. without having to use "
+ "the QT4_WRAP_CPP() macro. Currently Qt4 is supported. "
+ "When this property is set to TRUE, CMake will scan the source files "
+ "at build time and invoke moc accordingly. "
+ "If an #include statement like #include \"moc_foo.cpp\" is found, "
+ "the Q_OBJECT class declaration is expected in the header, and moc is "
+ "run on the header file. "
+ "If an #include statement like #include \"foo.moc\" is found, "
+ "then a Q_OBJECT is expected in the current source file and moc "
+ "is run on the file itself. "
+ "Additionally, all header files are parsed for Q_OBJECT macros, "
+ "and if found, moc is also executed on those files. The resulting "
+ "moc files, which are not included as shown above in any of the source "
+ "files are included in a generated <targetname>_automoc.cpp file, "
+ "which is compiled as part of the target."
+ "This property is initialized by the value of the variable "
+ "CMAKE_AUTOMOC if it is set when a target is created.");
+
+ cm->DefineProperty
("BUILD_WITH_INSTALL_RPATH", cmProperty::TARGET,
"Should build tree targets have install tree rpaths.",
"BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link "
@@ -960,6 +982,14 @@ void cmTarget::DefineProperties(cmake *cm)
"Visual Studio Source Code Control Project.",
"Can be set to change the visual studio source code control "
"project name property.");
+ cm->DefineProperty
+ ("VS_GLOBAL_<variable>", cmProperty::TARGET,
+ "Visual Studio project-specific global variable.",
+ "Tell the Visual Studio generator to set the global variable "
+ "'<variable>' to a given value in the generated Visual Studio "
+ "project. Ignored on other generators. Qt integration works "
+ "better if VS_GLOBAL_QtVersion is set to the version "
+ "FindQt4.cmake found. For example, \"4.7.3\"");
#if 0
cm->DefineProperty
@@ -1110,6 +1140,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
+ this->SetPropertyDefault("AUTOMOC", 0);
// Collect the set of configuration types.
std::vector<std::string> configNames;
@@ -1412,7 +1443,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
// the fact that the name matched a target was just a coincidence.
if(cmSystemTools::FileIsFullPath(dep.c_str()))
{
- if(t->GetType() >= cmTarget::EXECUTABLE &&
+ if(t->GetType() >= cmTarget::EXECUTABLE &&
t->GetType() <= cmTarget::MODULE_LIBRARY)
{
// This is really only for compatibility so we do not need to
@@ -2191,13 +2222,14 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTarget::AppendProperty(const char* prop, const char* value)
+void cmTarget::AppendProperty(const char* prop, const char* value,
+ bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TARGET);
+ this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
}
@@ -3688,9 +3720,11 @@ const char* cmTarget::GetOutputTargetType(bool implib)
}
//----------------------------------------------------------------------------
-void cmTarget::ComputeOutputDir(const char* config,
+bool cmTarget::ComputeOutputDir(const char* config,
bool implib, std::string& out)
{
+ bool usesDefaultOutputDir = false;
+
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(implib);
@@ -3742,6 +3776,7 @@ void cmTarget::ComputeOutputDir(const char* config,
if(out.empty())
{
// Default to the current output directory.
+ usesDefaultOutputDir = true;
out = ".";
}
@@ -3757,6 +3792,15 @@ void cmTarget::ComputeOutputDir(const char* config,
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("/", config, "", out);
}
+
+ return usesDefaultOutputDir;
+}
+
+//----------------------------------------------------------------------------
+bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib)
+{
+ std::string dir;
+ return this->ComputeOutputDir(config, implib, dir);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3b1f016..26fcef2 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -224,7 +224,7 @@ public:
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
@@ -446,6 +446,10 @@ public:
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const;
+ /** Return whether this target uses the default value for its output
+ directory. */
+ bool UsesDefaultOutputDir(const char* config, bool implib);
+
private:
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
@@ -558,7 +562,7 @@ private:
// Cache target output paths for each configuration.
struct OutputInfo;
OutputInfo const* GetOutputInfo(const char* config);
- void ComputeOutputDir(const char* config, bool implib, std::string& out);
+ bool ComputeOutputDir(const char* config, bool implib, std::string& out);
// Cache import information from properties for each configuration.
struct ImportInfo;
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index c25a8b6..502c174 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -84,13 +84,13 @@ void cmTest::SetProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
-void cmTest::AppendProperty(const char* prop, const char* value)
+void cmTest::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
return;
}
- this->Properties.AppendProperty(prop, value, cmProperty::TEST);
+ this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTest.h b/Source/cmTest.h
index e27a24e..6223a01 100644
--- a/Source/cmTest.h
+++ b/Source/cmTest.h
@@ -47,7 +47,7 @@ public:
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char* prop, const char* value);
+ void AppendProperty(const char* prop, const char* value,bool asString=false);
const char *GetProperty(const char *prop) const;
bool GetPropertyAsBool(const char *prop) const;
cmPropertyMap &GetProperties() { return this->Properties; };
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 9923d03..0d57633 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -25,7 +25,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ virtual cmCommand* Clone()
{
return new cmTryCompileCommand;
}
@@ -45,7 +45,7 @@ public:
/**
* Succinct documentation.
*/
- virtual const char* GetTerseDocumentation()
+ virtual const char* GetTerseDocumentation()
{
return "Try building some code.";
}
@@ -102,14 +102,15 @@ public:
"In both versions of the command, "
"if OUTPUT_VARIABLE is specified, then the "
"output from the build process is stored in the given variable. "
- "Return the success or failure in "
+ "The success or failure of the try_compile, i.e. TRUE or FALSE "
+ "respectively, is returned in "
"RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
"to the cmake that is run during the build. "
"Set variable CMAKE_TRY_COMPILE_CONFIGURATION to choose a build "
"configuration."
;
}
-
+
cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
};
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 4d31a14..c9c4ed5 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -194,7 +194,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
int timeout = 0;
bool worked = cmSystemTools::RunSingleCommand(finalCommand.c_str(),
out, &retVal,
- 0, false, timeout);
+ 0, cmSystemTools::OUTPUT_NONE, timeout);
// set the run var
char retChar[1000];
if (worked)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d710405..551b0ad 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,8 +178,23 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
- this->WriteString("<SccProjectName />\n", 2);
- this->WriteString("<SccLocalPath />\n", 2);
+ const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
+ const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
+ const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
+
+ if ( vsProjectName && vsLocalPath && vsProvider)
+ {
+ this->WriteString("<SccProjectName>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) <<
+ "</SccProjectName>\n";
+ this->WriteString("<SccLocalPath>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsLocalPath) <<
+ "</SccLocalPath>\n";
+ this->WriteString("<SccProvider>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
+ "</SccProvider>\n";
+ }
+
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
@@ -422,7 +437,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
(*this->BuildFileStream ) << sep << out;
sep = ";";
}
- (*this->BuildFileStream ) << ";%(Outputs)</Outputs>\n";
+ (*this->BuildFileStream ) << "</Outputs>\n";
}
this->WriteString("</CustomBuild>\n", 2);
}
@@ -1563,6 +1578,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ // skip fortran targets as they can not be processed by MSBuild
+ // the only reference will be in the .sln file
+ if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+ ->TargetIsFortranOnly(*dt))
+ {
+ continue;
+ }
this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile();
std::string name = dt->GetName();
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 71c7c25..30e5076 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -241,7 +241,7 @@ void cmXCodeObject::PrintString(std::ostream& os,cmStdString String)
// considered special by the Xcode project file parser.
bool needQuote =
(String.empty() ||
- String.find_first_of(" <>.+-=@$[]") != String.npos);
+ String.find_first_of(" <>.+-=@$[],") != String.npos);
const char* quote = needQuote? "\"" : "";
// Print the string, quoted and escaped as necessary.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index cc9dd8f..2b8c718 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -20,6 +20,7 @@
#include "cmCommand.h"
#include "cmFileTimeComparison.h"
#include "cmGeneratedFileStream.h"
+#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmTest.h"
@@ -62,8 +63,10 @@
# include "cmGlobalVisualStudio71Generator.h"
# include "cmGlobalVisualStudio8Generator.h"
# include "cmGlobalVisualStudio9Generator.h"
+# include "cmGlobalVisualStudio9IA64Generator.h"
# include "cmGlobalVisualStudio9Win64Generator.h"
# include "cmGlobalVisualStudio10Generator.h"
+# include "cmGlobalVisualStudio10IA64Generator.h"
# include "cmGlobalVisualStudio10Win64Generator.h"
# include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
@@ -1418,7 +1421,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
- directory.c_str(), true, timeout) )
+ directory.c_str(), cmSystemTools::OUTPUT_MERGE, timeout) )
{
return retval;
}
@@ -1691,6 +1694,12 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
{
return cmake::ExecuteEchoColor(args);
}
+ else if (args[1] == "cmake_automoc")
+ {
+ cmQtAutomoc automoc;
+ automoc.Run(args[2].c_str());
+ return 0;
+ }
#endif
// Tar files
@@ -2561,6 +2570,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio7Generator::New;
this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
&cmGlobalVisualStudio10Generator::New;
+ this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] =
+ &cmGlobalVisualStudio10IA64Generator::New;
this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
&cmGlobalVisualStudio10Win64Generator::New;
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
@@ -2569,6 +2580,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio8Generator::New;
this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] =
&cmGlobalVisualStudio9Generator::New;
+ this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] =
+ &cmGlobalVisualStudio9IA64Generator::New;
this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] =
&cmGlobalVisualStudio9Win64Generator::New;
this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
@@ -3034,6 +3047,13 @@ const char* cmake::GetCPackCommand()
return this->CPackCommand.c_str();
}
+
+const char* cmake::GetCMakeCommand()
+{
+ return this->CMakeCommand.c_str();
+}
+
+
void cmake::MarkCliAsUsed(const std::string& variable)
{
this->UsedCliVariables[variable] = true;
@@ -3657,7 +3677,7 @@ void cmake::SetProperty(const char* prop, const char* value)
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
}
-void cmake::AppendProperty(const char* prop, const char* value)
+void cmake::AppendProperty(const char* prop, const char* value, bool asString)
{
if (!prop)
{
@@ -3670,7 +3690,7 @@ void cmake::AppendProperty(const char* prop, const char* value)
this->DebugConfigs.clear();
}
- this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL);
+ this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
}
const char *cmake::GetProperty(const char* prop)
@@ -4099,7 +4119,7 @@ bool cmake::RunCommand(const char* comment,
// use rc command to create .res file
cmSystemTools::RunSingleCommand(command,
&output,
- &retCode, 0, false);
+ &retCode, 0, cmSystemTools::OUTPUT_NONE);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
// returned an error code then print the output anyway as
@@ -4417,7 +4437,8 @@ int cmake::Build(const std::string& dir,
const std::string& target,
const std::string& config,
const std::vector<std::string>& nativeOptions,
- bool clean)
+ bool clean,
+ cmSystemTools::OutputOption outputflag)
{
if(!cmSystemTools::FileIsDirectory(dir.c_str()))
{
@@ -4459,7 +4480,7 @@ int cmake::Build(const std::string& dir,
projName.c_str(), target.c_str(),
&output,
makeProgram.c_str(),
- config.c_str(), clean, false, 0, true,
+ config.c_str(), clean, false, 0, outputflag,
0, nativeOptions);
}
diff --git a/Source/cmake.h b/Source/cmake.h
index 46d375e..ae56e85 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -282,7 +282,7 @@ class cmake
///! Set/Get a property of this target file
void SetProperty(const char *prop, const char *value);
- void AppendProperty(const char *prop, const char *value);
+ void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop);
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
@@ -315,6 +315,7 @@ class cmake
*/
const char* GetCTestCommand();
const char* GetCPackCommand();
+ const char* GetCMakeCommand();
// Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; }
@@ -378,7 +379,8 @@ class cmake
const std::string& target,
const std::string& config,
const std::vector<std::string>& nativeOptions,
- bool clean);
+ bool clean,
+ cmSystemTools::OutputOption outputflag);
void UnwatchUnusedCli(const char* var);
void WatchUnusedCli(const char* var);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 828d2aa..9f213a5 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -62,6 +62,7 @@ static const char * cmDocumentationDescription[][3] =
" --config <cfg> = For multi-configuration tools, choose <cfg>.\n" \
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
+ " --use-stderr = Don't merge stdout/stderr.\n" \
" -- = Pass remaining options to the native tool.\n"
//----------------------------------------------------------------------------
@@ -579,6 +580,7 @@ static int do_build(int ac, char** av)
std::string dir;
std::vector<std::string> nativeOptions;
bool clean = false;
+ cmSystemTools::OutputOption outputflag = cmSystemTools::OUTPUT_MERGE;
enum Doing { DoingNone, DoingDir, DoingTarget, DoingConfig, DoingNative};
Doing doing = DoingDir;
@@ -601,6 +603,10 @@ static int do_build(int ac, char** av)
clean = true;
doing = DoingNone;
}
+ else if(strcmp(av[i], "--use-stderr") == 0)
+ {
+ outputflag = cmSystemTools::OUTPUT_NORMAL;
+ }
else if(strcmp(av[i], "--") == 0)
{
doing = DoingNative;
@@ -646,6 +652,6 @@ static int do_build(int ac, char** av)
}
cmake cm;
- return cm.Build(dir, target, config, nativeOptions, clean);
+ return cm.Build(dir, target, config, nativeOptions, clean, outputflag);
#endif
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index eefa7f5..695949a 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -56,6 +56,7 @@
// support for realpath call
#ifndef _WIN32
+#include <sys/time.h>
#include <utime.h>
#include <limits.h>
#include <sys/wait.h>
@@ -281,71 +282,29 @@ extern int putenv (char *__string) __THROW;
}
#endif
-/* Implement floattime() for various platforms */
-// Taken from Python 2.1.3
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-# include <sys/timeb.h>
-# define HAVE_FTIME
-# if defined( __BORLANDC__)
-# define FTIME ftime
-# define TIMEB timeb
-# else // Visual studio?
-# define FTIME _ftime
-# define TIMEB _timeb
-# endif
-#elif defined( __CYGWIN__ ) || defined( __linux__ ) || defined(__APPLE__)
-# include <sys/time.h>
-# include <time.h>
-# define HAVE_GETTIMEOFDAY
-#endif
-
namespace KWSYS_NAMESPACE
{
+double SystemTools::GetTime(void)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ return (429.4967296*ft.dwHighDateTime
+ + 0.0000001*ft.dwLowDateTime
+ - 11644473600.0);
+#else
+ struct timeval t;
+ gettimeofday(&t, 0);
+ return 1.0*double(t.tv_sec) + 0.000001*double(t.tv_usec);
+#endif
+}
+
class SystemToolsTranslationMap :
public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
{
};
-
-double
-SystemTools::GetTime(void)
-{
- /* There are three ways to get the time:
- (1) gettimeofday() -- resolution in microseconds
- (2) ftime() -- resolution in milliseconds
- (3) time() -- resolution in seconds
- In all cases the return value is a float in seconds.
- Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may
- fail, so we fall back on ftime() or time().
- Note: clock resolution does not imply clock accuracy! */
-#ifdef HAVE_GETTIMEOFDAY
- {
- struct timeval t;
-#ifdef GETTIMEOFDAY_NO_TZ
- if (gettimeofday(&t) == 0)
-#else /* !GETTIMEOFDAY_NO_TZ */
- if (gettimeofday(&t, static_cast<struct timezone *>(NULL)) == 0)
-#endif /* !GETTIMEOFDAY_NO_TZ */
- return static_cast<double>(t.tv_sec) +
- static_cast<double>(t.tv_usec)*0.000001;
- }
-#endif /* !HAVE_GETTIMEOFDAY */
- {
-#if defined(HAVE_FTIME)
- struct TIMEB t;
- ::FTIME(&t);
- return static_cast<double>(t.time) +
- static_cast<double>(t.millitm) * static_cast<double>(0.001);
-#else /* !HAVE_FTIME */
- time_t secs;
- time(&secs);
- return static_cast<double>(secs);
-#endif /* !HAVE_FTIME */
- }
-}
-
// adds the elements of the env variable path to the arg passed in
void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
{
@@ -4614,8 +4573,6 @@ void SystemTools::ClassInitialize()
// for windows because drive letters need to be maintained. Also,
// there are not sym-links and mount points on windows anyway.
#if !defined(_WIN32) || defined(__CYGWIN__)
- // Work-around an SGI problem by always adding this mapping:
- SystemTools::AddTranslationPath("/tmp_mnt/", "/");
// The tmp path is frequently a logical path so always keep it:
SystemTools::AddKeepPath("/tmp/");
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index cf47923..fd2ed19 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -690,13 +690,7 @@ public:
* -----------------------------------------------------------------
*/
- /**
- * Get current time as a double. On certain platforms this will
- * return higher resolution than seconds:
- * (1) gettimeofday() -- resolution in microseconds
- * (2) ftime() -- resolution in milliseconds
- * (3) time() -- resolution in seconds
- */
+ /** Get current time in seconds since Posix Epoch (Jan 1, 1970). */
static double GetTime();
/**
diff --git a/Source/kwsys/hash_fun.hxx.in b/Source/kwsys/hash_fun.hxx.in
index f21efc5..926ec92 100644
--- a/Source/kwsys/hash_fun.hxx.in
+++ b/Source/kwsys/hash_fun.hxx.in
@@ -38,7 +38,7 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
+#include <@KWSYS_NAMESPACE@/FundamentalType.h>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t
namespace @KWSYS_NAMESPACE@
@@ -110,6 +110,28 @@ struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
+// use long long or __int64
+#if @KWSYS_NAMESPACE@_USE_LONG_LONG
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<long long> {
+ size_t operator()(long long __x) const { return __x; }
+};
+
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned long long> {
+ size_t operator()(unsigned long long __x) const { return __x; }
+};
+#elif @KWSYS_NAMESPACE@_USE___INT64
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<__int64> {
+ size_t operator()(__int64 __x) const { return __x; }
+};
+@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
+struct hash<unsigned __int64> {
+ size_t operator()(unsigned __int64 __x) const { return __x; }
+};
+#endif // use long long or __int64
+
} // namespace @KWSYS_NAMESPACE@
#endif
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 7ec4e61..2644ba5 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2011)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 07)
+SET(KWSYS_DATE_STAMP_MONTH 08)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 02)
+SET(KWSYS_DATE_STAMP_DAY 25)