summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt8
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPack7zGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackTGZGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackTXZGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.cxx2
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackZIPGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx3
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx8
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx43
-rw-r--r--Source/CursesDialog/ccmake.cxx1
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx44
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h3
-rw-r--r--Source/CursesDialog/cmCursesDummyWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesFilePathWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx1
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx169
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h2
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesPathWidget.cxx4
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx2
-rw-r--r--Source/CursesDialog/cmCursesWidget.h6
-rw-r--r--Source/QtDialog/QCMake.cxx103
-rw-r--r--Source/cmAddLibraryCommand.cxx3
-rw-r--r--Source/cmArchiveWrite.cxx44
-rw-r--r--Source/cmArchiveWrite.h12
-rw-r--r--Source/cmBootstrapCommands1.cxx3
-rw-r--r--Source/cmBootstrapCommands2.cxx3
-rw-r--r--Source/cmBuildCommand.cxx2
-rw-r--r--Source/cmBuildNameCommand.cxx4
-rw-r--r--Source/cmCLocaleEnvironmentScope.cxx67
-rw-r--r--Source/cmCLocaleEnvironmentScope.h32
-rw-r--r--Source/cmCPluginAPI.cxx22
-rw-r--r--Source/cmCTest.cxx13
-rw-r--r--Source/cmCacheManager.cxx112
-rw-r--r--Source/cmCacheManager.h115
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx4
-rw-r--r--Source/cmCommands.cxx.in2
-rw-r--r--Source/cmCommands.h8
-rw-r--r--Source/cmCommandsForBootstrap.cxx2
-rw-r--r--Source/cmComputeLinkInformation.cxx63
-rw-r--r--Source/cmComputeLinkInformation.h4
-rw-r--r--Source/cmComputeTargetDepends.cxx7
-rw-r--r--Source/cmConditionEvaluator.cxx4
-rw-r--r--Source/cmCoreTryCompile.cxx3
-rw-r--r--Source/cmDefinePropertyCommand.cxx3
-rw-r--r--Source/cmDocumentation.cxx15
-rw-r--r--Source/cmDocumentation.h1
-rw-r--r--Source/cmDocumentationFormatter.cxx2
-rw-r--r--Source/cmDocumentationFormatter.h4
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx15
-rw-r--r--Source/cmFileCommand.cxx2
-rw-r--r--Source/cmFindBase.cxx14
-rw-r--r--Source/cmFindLibraryCommand.cxx15
-rw-r--r--Source/cmFindPackageCommand.cxx37
-rw-r--r--Source/cmFindPathCommand.cxx7
-rw-r--r--Source/cmFindProgramCommand.cxx7
-rw-r--r--Source/cmFunctionCommand.cxx5
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx4
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx8
-rw-r--r--Source/cmGetPropertyCommand.cxx17
-rw-r--r--Source/cmGlobalGenerator.cxx50
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx40
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h15
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx27
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx27
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx2
-rw-r--r--Source/cmLoadCacheCommand.cxx8
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx1
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx3
-rw-r--r--Source/cmMacroCommand.cxx5
-rw-r--r--Source/cmMakefile.cxx151
-rw-r--r--Source/cmMakefile.h36
-rw-r--r--Source/cmMakefileTargetGenerator.cxx62
-rw-r--r--Source/cmMakefileTargetGenerator.h3
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx17
-rw-r--r--Source/cmOptionCommand.cxx14
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmProjectCommand.cxx6
-rw-r--r--Source/cmPropertyMap.cxx4
-rw-r--r--Source/cmQtAutoGenerators.cxx16
-rw-r--r--Source/cmSetCommand.cxx15
-rw-r--r--Source/cmSetPropertyCommand.cxx21
-rw-r--r--Source/cmSetPropertyCommand.h2
-rw-r--r--Source/cmSiteNameCommand.cxx2
-rw-r--r--Source/cmState.cxx446
-rw-r--r--Source/cmState.h107
-rw-r--r--Source/cmSystemTools.cxx7
-rw-r--r--Source/cmSystemTools.h3
-rw-r--r--Source/cmTarget.cxx22
-rw-r--r--Source/cmTarget.h6
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx2
-rw-r--r--Source/cmTryRunCommand.cxx26
-rw-r--r--Source/cmUtilitySourceCommand.cxx12
-rw-r--r--Source/cmVariableRequiresCommand.cxx8
-rw-r--r--Source/cmXCode21Object.cxx6
-rw-r--r--Source/cmXCodeObject.cxx22
-rw-r--r--Source/cmake.cxx607
-rw-r--r--Source/cmake.h111
-rw-r--r--Source/cmakemain.cxx30
-rw-r--r--Source/cmcmd.cxx33
-rw-r--r--Source/kwsys/SystemTools.cxx17
128 files changed, 1883 insertions, 1323 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 064b827..6f12785 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -159,6 +159,8 @@ set(SRCS
cmCacheManager.cxx
cmCacheManager.h
"${CMAKE_CURRENT_BINARY_DIR}/cmCommands.cxx"
+ cmCLocaleEnvironmentScope.h
+ cmCLocaleEnvironmentScope.cxx
cmCommands.h
cmCommandArgumentLexer.cxx
cmCommandArgumentParser.cxx
@@ -219,6 +221,8 @@ set(SRCS
cmExportSet.cxx
cmExportSetMap.h
cmExportSetMap.cxx
+ cmExternalMakefileProjectGenerator.cxx
+ cmExternalMakefileProjectGenerator.h
cmExtraCodeBlocksGenerator.cxx
cmExtraCodeBlocksGenerator.h
cmExtraCodeLiteGenerator.cxx
@@ -244,6 +248,8 @@ set(SRCS
cmGeneratorExpressionContext.h
cmGeneratorExpressionDAGChecker.cxx
cmGeneratorExpressionDAGChecker.h
+ cmGeneratorExpressionEvaluationFile.cxx
+ cmGeneratorExpressionEvaluationFile.h
cmGeneratorExpressionEvaluator.cxx
cmGeneratorExpressionEvaluator.h
cmGeneratorExpressionLexer.cxx
@@ -323,6 +329,8 @@ set(SRCS
cmSourceFileLocation.h
cmSourceGroup.cxx
cmSourceGroup.h
+ cmState.cxx
+ cmState.h
cmSystemTools.cxx
cmSystemTools.h
cmTarget.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 5214832..0e96a1b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 2)
-set(CMake_VERSION_PATCH 20150408)
+set(CMake_VERSION_PATCH 20150420)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx
index ce31ad4..2809e56 100644
--- a/Source/CPack/cmCPack7zGenerator.cxx
+++ b/Source/CPack/cmCPack7zGenerator.cxx
@@ -15,7 +15,7 @@
//----------------------------------------------------------------------
cmCPack7zGenerator::cmCPack7zGenerator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
- cmArchiveWrite::Type7Zip)
+ "7zip")
{
}
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 05b5cd9..58bd947 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -27,10 +27,10 @@
//----------------------------------------------------------------------
cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
- cmArchiveWrite::Type at)
+ std::string const& format)
{
this->Compress = t;
- this->Archive = at;
+ this->ArchiveFormat = format;
}
//----------------------------------------------------------------------
@@ -108,7 +108,7 @@ if (!GenerateHeader(&gf)) \
<< ">." << std::endl); \
return 0; \
} \
-cmArchiveWrite archive(gf,this->Compress, this->Archive); \
+cmArchiveWrite archive(gf,this->Compress, this->ArchiveFormat); \
if (!archive) \
{ \
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 6411b1e..16e7632 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -31,7 +31,7 @@ public:
/**
* Construct generator
*/
- cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type);
+ cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format);
virtual ~cmCPackArchiveGenerator();
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
@@ -68,7 +68,7 @@ protected:
int PackageComponentsAllInOne();
virtual const char* GetOutputExtension() = 0;
cmArchiveWrite::Compress Compress;
- cmArchiveWrite::Type Archive;
+ std::string ArchiveFormat;
};
#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 995eb0d..4f37041 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1501,8 +1501,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const
{
return (!IsOn("CPACK_MONOLITHIC_INSTALL")
&& SupportsComponentInstallation()
- // check that package at least has components
- && !(this->ComponentGroups.empty() || this->Components.empty()));
+ // check that we have at least one group or component
+ && (!this->ComponentGroups.empty() || !this->Components.empty()));
}
//----------------------------------------------------------------------
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx
index 509c7f8..3fa2b64 100644
--- a/Source/CPack/cmCPackTGZGenerator.cxx
+++ b/Source/CPack/cmCPackTGZGenerator.cxx
@@ -15,7 +15,7 @@
//----------------------------------------------------------------------
cmCPackTGZGenerator::cmCPackTGZGenerator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip,
- cmArchiveWrite::TypeTAR)
+ "paxr")
{
}
diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx
index ecfc177..6d4ede1 100644
--- a/Source/CPack/cmCPackTXZGenerator.cxx
+++ b/Source/CPack/cmCPackTXZGenerator.cxx
@@ -15,7 +15,7 @@
//----------------------------------------------------------------------
cmCPackTXZGenerator::cmCPackTXZGenerator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ,
- cmArchiveWrite::TypeTAR)
+ "paxr")
{
}
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
index ae73c37..9ff588b 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ b/Source/CPack/cmCPackTarBZip2Generator.cxx
@@ -14,7 +14,7 @@
//----------------------------------------------------------------------
cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2,
- cmArchiveWrite::TypeTAR)
+ "paxr")
{
}
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx
index df29408..1c8311b 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.cxx
+++ b/Source/CPack/cmCPackTarCompressGenerator.cxx
@@ -15,7 +15,7 @@
//----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress,
- cmArchiveWrite::TypeTAR)
+ "paxr")
{
}
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx
index e6e4e77..7ef7729 100644
--- a/Source/CPack/cmCPackZIPGenerator.cxx
+++ b/Source/CPack/cmCPackZIPGenerator.cxx
@@ -15,7 +15,7 @@
//----------------------------------------------------------------------
cmCPackZIPGenerator::cmCPackZIPGenerator()
:cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
- cmArchiveWrite::TypeZIP)
+ "zip")
{
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 00b23cd..a9cabf1 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -198,7 +198,7 @@ int main (int argc, char const* const* argv)
"Read CPack config file: " << cpackConfigFile << std::endl);
cmake cminst;
- cminst.RemoveUnscriptableCommands();
+ cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg;
cmgg.SetCMakeInstance(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 0827037..586070b 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -18,7 +18,6 @@
#include "cmGlobalGenerator.h"
#include <cmsys/Process.h>
#include "cmCTestTestHandler.h"
-#include "cmCacheManager.h"
//----------------------------------------------------------------------
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
@@ -255,7 +254,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
cm.SetGeneratorToolset(this->BuildGeneratorToolset);
// Load the cache to make CMAKE_MAKE_PROGRAM available.
- cm.GetCacheManager()->LoadCache(this->BinaryDir);
+ cm.LoadCache(this->BinaryDir);
}
else
{
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 3792953..783941b 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -214,7 +214,7 @@ void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
cmCTestCommand* newCom = command;
newCom->CTest = this->CTest;
newCom->CTestScriptHandler = this;
- this->CMake->AddCommand(newCom);
+ this->CMake->GetState()->AddCommand(newCom);
}
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
@@ -353,7 +353,7 @@ void cmCTestScriptHandler::CreateCMake()
// remove all cmake commands which are not scriptable, since they can't be
// used in ctest scripts
- this->CMake->RemoveUnscriptableCommands();
+ this->CMake->GetState()->RemoveUnscriptableCommands();
// add any ctest specific commands, probably should have common superclass
// for ctest commands to clean this up. If a couple more commands are
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index d585863..1e12f15 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -17,6 +17,7 @@
#include "cmGeneratedFileStream.h"
#include "cmCTest.h"
#include "cmXMLParser.h"
+#include "cmState.h"
#include <cmsys/Process.h>
#include <cmsys/Base64.h>
@@ -1132,7 +1133,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
cmCTestScriptHandler* ch =
static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script"));
cmake* cm = ch->GetCMake();
- const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL);
+ const char* subproject = cm->GetState()->GetGlobalProperty("SubProject");
// TODO: Encode values for a URL instead of trusting caller.
std::ostringstream str;
str << "project="
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 0e84fbf..c50ea88 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1585,25 +1585,25 @@ void cmCTestTestHandler::GetListOfTests()
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
newCom1->TestHandler = this;
- cm.AddCommand(newCom1);
+ cm.GetState()->AddCommand(newCom1);
// Add handler for SUBDIRS
cmCTestSubdirCommand* newCom2 =
new cmCTestSubdirCommand;
newCom2->TestHandler = this;
- cm.AddCommand(newCom2);
+ cm.GetState()->AddCommand(newCom2);
// Add handler for ADD_SUBDIRECTORY
cmCTestAddSubdirectoryCommand* newCom3 =
new cmCTestAddSubdirectoryCommand;
newCom3->TestHandler = this;
- cm.AddCommand(newCom3);
+ cm.GetState()->AddCommand(newCom3);
// Add handler for SET_SOURCE_FILES_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom4
= new cmCTestSetTestsPropertiesCommand;
newCom4->TestHandler = this;
- cm.AddCommand(newCom4);
+ cm.GetState()->AddCommand(newCom4);
const char* testFilename;
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index b9da8a0..10927e7 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -21,6 +21,7 @@
#include "cmGeneratedFileStream.h"
#include "cmXMLParser.h"
#include "cmXMLSafe.h"
+#include "cmCLocaleEnvironmentScope.h"
#include "cmCTestVC.h"
#include "cmCTestCVS.h"
@@ -66,46 +67,6 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type)
return cmCTestUpdateHandlerUpdateStrings[type];
}
-class cmCTestUpdateHandlerLocale
-{
-public:
- cmCTestUpdateHandlerLocale();
- ~cmCTestUpdateHandlerLocale();
-private:
- std::string saveLCAll;
-};
-
-cmCTestUpdateHandlerLocale::cmCTestUpdateHandlerLocale()
-{
- const char* lcall = cmSystemTools::GetEnv("LC_ALL");
- if(lcall)
- {
- saveLCAll = lcall;
- }
- // if LC_ALL is not set to C, then
- // set it, so that svn/cvs info will be in english ascii
- if(! (lcall && strcmp(lcall, "C") == 0))
- {
- cmSystemTools::PutEnv("LC_ALL=C");
- }
-}
-
-cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
-{
- // restore the value of LC_ALL after running the version control
- // commands
- if(!saveLCAll.empty())
- {
- std::string put = "LC_ALL=";
- put += saveLCAll;
- cmSystemTools::PutEnv(put);
- }
- else
- {
- cmSystemTools::UnsetEnv("LC_ALL");
- }
-}
-
//----------------------------------------------------------------------
cmCTestUpdateHandler::cmCTestUpdateHandler()
{
@@ -194,7 +155,7 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type)
int cmCTestUpdateHandler::ProcessHandler()
{
// Make sure VCS tool messages are in English so we can parse them.
- cmCTestUpdateHandlerLocale fixLocale;
+ cmCLocaleEnvironmentScope fixLocale;
static_cast<void>(fixLocale);
// Get source dir
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 3d92a2d..e013f81 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
#include "../cmDocumentation.h"
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx
index fd15b99..29d9cb2 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.cxx
+++ b/Source/CursesDialog/cmCursesBoolWidget.cxx
@@ -16,7 +16,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height,
int left, int top) :
cmCursesWidget(width, height, left, top)
{
- this->Type = cmCacheManager::BOOL;
+ this->Type = cmState::BOOL;
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
field_opts_off(this->Field, O_STATIC);
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 682f95f..7e09242 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -18,6 +18,10 @@
#include "cmCursesFilePathWidget.h"
#include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h"
+#include "../cmake.h"
+#include "../cmState.h"
+
+#include <assert.h>
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
const std::string& key,
@@ -32,7 +36,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew,
+ const std::string& key, cmake *cm, bool isNew,
int labelwidth, int entrywidth)
: Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
{
@@ -47,11 +51,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
this->Entry = 0;
- switch ( it.GetType() )
+ const char* value = cm->GetState()->GetCacheEntryValue(key);
+ assert(value);
+ switch (cm->GetState()->GetCacheEntryType(key))
{
- case cmCacheManager::BOOL:
+ case cmState::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
- if (cmSystemTools::IsOn(it.GetValue().c_str()))
+ if (cmSystemTools::IsOn(value))
{
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
}
@@ -60,42 +66,42 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false);
}
break;
- case cmCacheManager::PATH:
+ case cmState::PATH:
this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesPathWidget*>(this->Entry)->SetString(
- it.GetValue());
+ static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
break;
- case cmCacheManager::FILEPATH:
+ case cmState::FILEPATH:
this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(
- it.GetValue());
+ static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
break;
- case cmCacheManager::STRING:
- if(it.PropertyExists("STRINGS"))
+ case cmState::STRING:
+ {
+ const char* stringsProp = cm->GetState()
+ ->GetCacheEntryProperty(key, "STRINGS");
+ if(stringsProp)
{
cmCursesOptionsWidget* ow =
new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
this->Entry = ow;
std::vector<std::string> options;
- cmSystemTools::ExpandListArgument(
- std::string(it.GetProperty("STRINGS")), options);
+ cmSystemTools::ExpandListArgument(stringsProp, options);
for(std::vector<std::string>::iterator
si = options.begin(); si != options.end(); ++si)
{
ow->AddOption(*si);
}
- ow->SetOption(it.GetValue());
+ ow->SetOption(value);
}
else
{
this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
- it.GetValue());
+ static_cast<cmCursesStringWidget*>(this->Entry)->SetString(value);
}
break;
- case cmCacheManager::UNINITIALIZED:
+ }
+ case cmState::UNINITIALIZED:
cmSystemTools::Error("Found an undefined variable: ",
- it.GetName().c_str());
+ key.c_str());
break;
default:
// TODO : put warning message here
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 7cdf13b..f280897 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -12,7 +12,6 @@
#ifndef cmCursesCacheEntryComposite_h
#define cmCursesCacheEntryComposite_h
-#include "../cmCacheManager.h"
#include "cmCursesLabelWidget.h"
class cmCursesCacheEntryComposite
@@ -21,7 +20,7 @@ public:
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
int entrywidth);
cmCursesCacheEntryComposite(const std::string& key,
- const cmCacheManager::CacheIterator& it,
+ cmake *cm,
bool isNew, int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
const char* GetValue();
diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx
index 60086a5..9801e4d 100644
--- a/Source/CursesDialog/cmCursesDummyWidget.cxx
+++ b/Source/CursesDialog/cmCursesDummyWidget.cxx
@@ -15,7 +15,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height,
int left, int top) :
cmCursesWidget(width, height, left, top)
{
- this->Type = cmCacheManager::INTERNAL;
+ this->Type = cmState::INTERNAL;
}
diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx
index 01db014..51ed670 100644
--- a/Source/CursesDialog/cmCursesFilePathWidget.cxx
+++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx
@@ -15,6 +15,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height,
int left, int top) :
cmCursesPathWidget(width, height, left, top)
{
- this->Type = cmCacheManager::FILEPATH;
+ this->Type = cmState::FILEPATH;
}
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 057f8f3..67e4aab 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
#include "../cmVersion.h"
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index d60062e..be17a9f 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmVersion.h"
#include "../cmake.h"
@@ -23,6 +22,7 @@
#include "cmCursesCacheEntryComposite.h"
#include "cmCursesLongMessageForm.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
inline int ctrl(int z)
@@ -107,17 +107,21 @@ void cmCursesMainForm::InitializeUI()
// which contain labels, entries and new entry markers
std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>;
- newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize());
+ std::vector<std::string> cacheKeys =
+ this->CMakeInstance->GetState()->GetCacheEntryKeys();
+ newEntries->reserve(cacheKeys.size());
// Count non-internal and non-static entries
int count=0;
- for(cmCacheManager::CacheIterator i =
- this->CMakeInstance->GetCacheManager()->NewIterator();
- !i.IsAtEnd(); i.Next())
+
+ for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
- if ( i.GetType() != cmCacheManager::INTERNAL &&
- i.GetType() != cmCacheManager::STATIC &&
- i.GetType() != cmCacheManager::UNINITIALIZED)
+ cmState::CacheEntryType t = this->CMakeInstance->GetState()
+ ->GetCacheEntryType(*it);
+ if (t != cmState::INTERNAL &&
+ t != cmState::STATIC &&
+ t != cmState::UNINITIALIZED)
{
++count;
}
@@ -139,45 +143,49 @@ void cmCursesMainForm::InitializeUI()
// Create the composites.
// First add entries which are new
- for(cmCacheManager::CacheIterator i =
- this->CMakeInstance->GetCacheManager()->NewIterator();
- !i.IsAtEnd(); i.Next())
+ for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
- std::string key = i.GetName();
- if ( i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC ||
- i.GetType() == cmCacheManager::UNINITIALIZED )
+ std::string key = *it;
+ cmState::CacheEntryType t = this->CMakeInstance->GetState()
+ ->GetCacheEntryType(*it);
+ if (t == cmState::INTERNAL ||
+ t == cmState::STATIC ||
+ t == cmState::UNINITIALIZED )
{
continue;
}
if (!this->LookForCacheEntry(key))
{
- newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
- true, 30,
- entrywidth));
+ newEntries->push_back(new cmCursesCacheEntryComposite(key,
+ this->CMakeInstance,
+ true, 30,
+ entrywidth));
this->OkToGenerate = false;
}
}
// then add entries which are old
- for(cmCacheManager::CacheIterator i =
- this->CMakeInstance->GetCacheManager()->NewIterator();
- !i.IsAtEnd(); i.Next())
+ for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
- std::string key = i.GetName();
- if ( i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC ||
- i.GetType() == cmCacheManager::UNINITIALIZED )
+ std::string key = *it;
+ cmState::CacheEntryType t = this->CMakeInstance->GetState()
+ ->GetCacheEntryType(*it);
+ if (t == cmState::INTERNAL ||
+ t == cmState::STATIC ||
+ t == cmState::UNINITIALIZED )
{
continue;
}
if (this->LookForCacheEntry(key))
{
- newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
- false, 30,
- entrywidth));
+ newEntries->push_back(new cmCursesCacheEntryComposite(key,
+ this->CMakeInstance,
+ false, 30,
+ entrywidth));
}
}
}
@@ -216,10 +224,13 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
- if (mit.IsAtEnd() ||
- (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ const char* existingValue =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryValue((*it)->GetValue());
+ bool advanced =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+ if (!existingValue || (!this->AdvancedMode && advanced))
{
continue;
}
@@ -245,10 +256,13 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
- if (mit.IsAtEnd() ||
- (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ const char* existingValue =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryValue((*it)->GetValue());
+ bool advanced =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+ if (!existingValue || (!this->AdvancedMode && advanced))
{
continue;
}
@@ -279,9 +293,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*>
(field_userptr(currentField));
// If in edit mode, get out of it
- if ( cw->GetType() == cmCacheManager::STRING ||
- cw->GetType() == cmCacheManager::PATH ||
- cw->GetType() == cmCacheManager::FILEPATH )
+ if ( cw->GetType() == cmState::STRING ||
+ cw->GetType() == cmState::PATH ||
+ cw->GetType() == cmState::FILEPATH )
{
cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw);
sw->SetInEdit(false);
@@ -314,10 +328,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
- if (mit.IsAtEnd() ||
- (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ const char* existingValue =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryValue((*it)->GetValue());
+ bool advanced =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+ if (!existingValue || (!this->AdvancedMode && advanced))
{
continue;
}
@@ -334,10 +351,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
- cmCacheManager::CacheIterator mit =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
- if (mit.IsAtEnd() ||
- (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+ const char* existingValue =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryValue((*it)->GetValue());
+ bool advanced =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+ if (!existingValue || (!this->AdvancedMode && advanced))
{
continue;
}
@@ -495,11 +515,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Get the help string of the current entry
// and add it to the help string
- cmCacheManager::CacheIterator it =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
- if (!it.IsAtEnd())
+ const char* existingValue =
+ this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
+ if (existingValue)
{
- const char* hs = it.GetProperty("HELPSTRING");
+ const char* hs = this->CMakeInstance->GetState()
+ ->GetCacheEntryProperty(curField, "HELPSTRING");
if ( hs )
{
strncpy(help, hs, 127);
@@ -639,7 +660,7 @@ int cmCursesMainForm::Configure(int noconfigure)
// always save the current gui values to disk
this->FillCacheManagerFromUI();
- this->CMakeInstance->GetCacheManager()->SaveCache(
+ this->CMakeInstance->SaveCache(
this->CMakeInstance->GetHomeOutputDirectory());
this->LoadCache(0);
@@ -792,37 +813,42 @@ void cmCursesMainForm::FillCacheManagerFromUI()
size_t size = this->Entries->size();
for(size_t i=0; i < size; i++)
{
- cmCacheManager::CacheIterator it =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator(
- (*this->Entries)[i]->Key.c_str());
- if (!it.IsAtEnd())
+ std::string cacheKey = (*this->Entries)[i]->Key;
+ const char* existingValue = this->CMakeInstance->GetState()
+ ->GetCacheEntryValue(cacheKey);
+ if (existingValue)
{
- std::string oldValue = it.GetValue();
+ std::string oldValue = existingValue;
std::string newValue = (*this->Entries)[i]->Entry->GetValue();
std::string fixedOldValue;
std::string fixedNewValue;
- this->FixValue(it.GetType(), oldValue, fixedOldValue);
- this->FixValue(it.GetType(), newValue, fixedNewValue);
+ cmState::CacheEntryType t =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryType(cacheKey);
+ this->FixValue(t, oldValue, fixedOldValue);
+ this->FixValue(t, newValue, fixedNewValue);
if(!(fixedOldValue == fixedNewValue))
{
// The user has changed the value. Mark it as modified.
- it.SetProperty("MODIFIED", true);
- it.SetValue(fixedNewValue.c_str());
+ this->CMakeInstance->GetState()
+ ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
+ this->CMakeInstance->GetState()
+ ->SetCacheEntryValue(cacheKey, fixedNewValue);
}
}
}
}
-void cmCursesMainForm::FixValue(cmCacheManager::CacheEntryType type,
+void cmCursesMainForm::FixValue(cmState::CacheEntryType type,
const std::string& in, std::string& out) const
{
out = in.substr(0,in.find_last_not_of(" ")+1);
- if(type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH)
+ if(type == cmState::PATH || type == cmState::FILEPATH)
{
cmSystemTools::ConvertToUnixSlashes(out);
}
- if(type == cmCacheManager::BOOL)
+ if(type == cmState::BOOL)
{
if(cmSystemTools::IsOff(out.c_str()))
{
@@ -1017,12 +1043,15 @@ void cmCursesMainForm::HandleInput()
cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
this->Fields[findex-2]));
const char* curField = lbl->GetValue();
- const char* helpString=0;
- cmCacheManager::CacheIterator it =
- this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
- if (!it.IsAtEnd())
+ const char* helpString = 0;
+
+ const char* existingValue =
+ this->CMakeInstance->GetState()
+ ->GetCacheEntryValue(curField);
+ if (existingValue)
{
- helpString = it.GetProperty("HELPSTRING");
+ helpString = this->CMakeInstance->GetState()
+ ->GetCacheEntryProperty(curField, "HELPSTRING");
}
if (helpString)
{
@@ -1132,7 +1161,7 @@ void cmCursesMainForm::HandleInput()
field_userptr(this->Fields[findex-2]));
if ( lbl )
{
- this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
+ this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue());
std::string nextVal;
if (nextCur)
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 6455252..255c823 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -113,7 +113,7 @@ protected:
// cache.
void FillCacheManagerFromUI();
// Fix formatting of values to a consistent form.
- void FixValue(cmCacheManager::CacheEntryType type,
+ void FixValue(cmState::CacheEntryType type,
const std::string& in, std::string& out) const;
// Re-post the existing fields. Used to toggle between
// normal and advanced modes. Render() should be called
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index 2f4b59e..30110a4 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -21,7 +21,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height,
int left, int top) :
cmCursesWidget(width, height, left, top)
{
- this->Type = cmCacheManager::BOOL; // this is a bit of a hack
+ this->Type = cmState::BOOL; // this is a bit of a hack
// there is no option type, and string type causes ccmake to cast
// the widget into a string widget at some point. BOOL is safe for
// now.
diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx
index 89e2238..6116823 100644
--- a/Source/CursesDialog/cmCursesPathWidget.cxx
+++ b/Source/CursesDialog/cmCursesPathWidget.cxx
@@ -18,7 +18,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height,
int left, int top) :
cmCursesStringWidget(width, height, left, top)
{
- this->Type = cmCacheManager::PATH;
+ this->Type = cmState::PATH;
this->Cycle = false;
this->CurrentIndex = 0;
}
@@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w)
}
std::vector<std::string> dirs;
- cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0));
+ cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmState::PATH?-1:0));
if ( this->CurrentIndex < dirs.size() )
{
cstr = dirs[this->CurrentIndex];
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index d25022d..acf262f 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -22,7 +22,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height,
cmCursesWidget(width, height, left, top)
{
this->InEdit = false;
- this->Type = cmCacheManager::STRING;
+ this->Type = cmState::STRING;
set_field_fore(this->Field, A_NORMAL);
set_field_back(this->Field, A_STANDOUT);
field_opts_off(this->Field, O_STATIC);
diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h
index 7d82864..7bbdff1 100644
--- a/Source/CursesDialog/cmCursesWidget.h
+++ b/Source/CursesDialog/cmCursesWidget.h
@@ -12,7 +12,7 @@
#ifndef cmCursesWidget_h
#define cmCursesWidget_h
-#include "../cmCacheManager.h"
+#include "../cmState.h"
#include "cmCursesStandardIncludes.h"
class cmCursesMainForm;
@@ -46,7 +46,7 @@ public:
/**
* Get the type of the widget (STRING, PATH etc...)
*/
- cmCacheManager::CacheEntryType GetType()
+ cmState::CacheEntryType GetType()
{ return this->Type; }
/**
@@ -77,7 +77,7 @@ protected:
cmCursesWidget(const cmCursesWidget& from);
void operator=(const cmCursesWidget&);
- cmCacheManager::CacheEntryType Type;
+ cmState::CacheEntryType Type;
std::string Value;
FIELD* Field;
// The page in the main form this widget is in
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 996aa75..6524350 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -16,7 +16,7 @@
#include <QCoreApplication>
#include "cmake.h"
-#include "cmCacheManager.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h"
@@ -94,9 +94,9 @@ void QCMake::setBinaryDirectory(const QString& _dir)
{
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
emit this->binaryDirChanged(this->BinaryDirectory);
- cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
+ cmState* state = this->CMakeInstance->GetState();
this->setGenerator(QString());
- if(!this->CMakeInstance->GetCacheManager()->LoadCache(
+ if(!this->CMakeInstance->LoadCache(
this->BinaryDirectory.toLocal8Bit().data()))
{
QDir testDir(this->BinaryDirectory);
@@ -110,16 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir)
QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props);
- cmCacheManager::CacheIterator itm = cachem->NewIterator();
- if ( itm.Find("CMAKE_HOME_DIRECTORY"))
+ const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
+ if (homeDir)
{
- setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
+ setSourceDirectory(QString::fromLocal8Bit(homeDir));
}
- if ( itm.Find("CMAKE_GENERATOR"))
+ const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
+ if (gen)
{
- const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+ const char* extraGen = state
+ ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string curGen = cmExternalMakefileProjectGenerator::
- CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
+ CreateFullGeneratorName(gen, extraGen? extraGen : "");
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
}
}
@@ -193,34 +195,36 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
QStringList toremove;
// set the value of properties
- cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
- for(cmCacheManager::CacheIterator i = cachem->NewIterator();
- !i.IsAtEnd(); i.Next())
+ cmState* state = this->CMakeInstance->GetState();
+ std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
+ for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
-
- if(i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC)
+ cmState::CacheEntryType t = state->GetCacheEntryType(*it);
+ if(t == cmState::INTERNAL ||
+ t == cmState::STATIC)
{
continue;
}
QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
+ prop.Key = QString::fromLocal8Bit(it->c_str());
int idx = props.indexOf(prop);
if(idx == -1)
{
- toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
+ toremove.append(QString::fromLocal8Bit(it->c_str()));
}
else
{
prop = props[idx];
if(prop.Value.type() == QVariant::Bool)
{
- i.SetValue(prop.Value.toBool() ? "ON" : "OFF");
+ state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
}
else
{
- i.SetValue(prop.Value.toString().toLocal8Bit().data());
+ state->SetCacheEntryValue(*it,
+ prop.Value.toString().toLocal8Bit().data());
}
props.removeAt(idx);
}
@@ -232,7 +236,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
{
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
- cachem->RemoveCacheEntry(s.toLocal8Bit().data());
+ state->RemoveCacheEntry(s.toLocal8Bit().data());
}
// add some new properites
@@ -245,75 +249,80 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
s.Value.toBool() ? "ON" : "OFF",
s.Help.toLocal8Bit().data(),
- cmCacheManager::BOOL);
+ cmState::BOOL);
}
else if(s.Type == QCMakeProperty::STRING)
{
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
s.Value.toString().toLocal8Bit().data(),
s.Help.toLocal8Bit().data(),
- cmCacheManager::STRING);
+ cmState::STRING);
}
else if(s.Type == QCMakeProperty::PATH)
{
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
s.Value.toString().toLocal8Bit().data(),
s.Help.toLocal8Bit().data(),
- cmCacheManager::PATH);
+ cmState::PATH);
}
else if(s.Type == QCMakeProperty::FILEPATH)
{
this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
s.Value.toString().toLocal8Bit().data(),
s.Help.toLocal8Bit().data(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
}
}
- cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
+ this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
}
QCMakePropertyList QCMake::properties() const
{
QCMakePropertyList ret;
- cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
- for(cmCacheManager::CacheIterator i = cachem->NewIterator();
- !i.IsAtEnd(); i.Next())
+ cmState* state = this->CMakeInstance->GetState();
+ std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
+ for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
+ i != cacheKeys.end(); ++i)
{
-
- if(i.GetType() == cmCacheManager::INTERNAL ||
- i.GetType() == cmCacheManager::STATIC ||
- i.GetType() == cmCacheManager::UNINITIALIZED)
+ cmState::CacheEntryType t = state->GetCacheEntryType(*i);
+ if(t == cmState::INTERNAL ||
+ t == cmState::STATIC ||
+ t == cmState::UNINITIALIZED)
{
continue;
}
- QCMakeProperty prop;
- prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
- prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
- prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
- prop.Advanced = i.GetPropertyAsBool("ADVANCED");
+ const char* cachedValue = state->GetCacheEntryValue(*i);
- if(i.GetType() == cmCacheManager::BOOL)
+ QCMakeProperty prop;
+ prop.Key = QString::fromLocal8Bit(i->c_str());
+ prop.Help = QString::fromLocal8Bit(
+ state->GetCacheEntryProperty(*i, "HELPSTRING"));
+ prop.Value = QString::fromLocal8Bit(cachedValue);
+ prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
+ if(t == cmState::BOOL)
{
prop.Type = QCMakeProperty::BOOL;
- prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
+ prop.Value = cmSystemTools::IsOn(cachedValue);
}
- else if(i.GetType() == cmCacheManager::PATH)
+ else if(t == cmState::PATH)
{
prop.Type = QCMakeProperty::PATH;
}
- else if(i.GetType() == cmCacheManager::FILEPATH)
+ else if(t == cmState::FILEPATH)
{
prop.Type = QCMakeProperty::FILEPATH;
}
- else if(i.GetType() == cmCacheManager::STRING)
+ else if(t == cmState::STRING)
{
prop.Type = QCMakeProperty::STRING;
- if (i.PropertyExists("STRINGS"))
+ const char* stringsProperty =
+ state->GetCacheEntryProperty(*i, "STRINGS");
+ if (stringsProperty)
{
- prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";");
+ prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
}
}
@@ -397,9 +406,9 @@ QStringList QCMake::availableGenerators() const
void QCMake::deleteCache()
{
// delete cache
- this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
+ this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
// reload to make our cache empty
- this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
+ this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
// emit no generator and no properties
this->setGenerator(QString());
QCMakePropertyList props = this->properties();
@@ -412,7 +421,7 @@ void QCMake::reloadCache()
QCMakePropertyList props;
emit this->propertiesChanged(props);
// reload
- this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
+ this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
// emit new cache properties
props = this->properties();
emit this->propertiesChanged(props);
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index edf82bd..74e1a93 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -12,6 +12,7 @@
#include "cmAddLibraryCommand.h"
#include "cmake.h"
+#include "cmState.h"
// cmLibraryCommand
bool cmAddLibraryCommand
@@ -330,7 +331,7 @@ bool cmAddLibraryCommand
yet its linker language. */
if ((type == cmTarget::SHARED_LIBRARY ||
type == cmTarget::MODULE_LIBRARY) &&
- (this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
+ (this->Makefile->GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{
std::ostringstream w;
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index cf2fe82..72818f5 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -79,11 +79,12 @@ struct cmArchiveWrite::Callback
};
//----------------------------------------------------------------------------
-cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
- Stream(os),
- Archive(archive_write_new()),
- Disk(archive_read_disk_new()),
- Verbose(false)
+cmArchiveWrite::cmArchiveWrite(
+ std::ostream& os, Compress c, std::string const& format):
+ Stream(os),
+ Archive(archive_write_new()),
+ Disk(archive_read_disk_new()),
+ Verbose(false)
{
switch (c)
{
@@ -141,35 +142,16 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
{
this->Error = "archive_read_disk_set_standard_lookup: ";
this->Error += cm_archive_error_string(this->Archive);
- return;;
+ return;
}
#endif
- switch (t)
+
+ if(archive_write_set_format_by_name(this->Archive, format.c_str())
+ != ARCHIVE_OK)
{
- case TypeZIP:
- if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK)
- {
- this->Error = "archive_write_set_format_zip: ";
- this->Error += cm_archive_error_string(this->Archive);
- return;
- }
- break;
- case TypeTAR:
- if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK)
- {
- this->Error = "archive_write_set_format_pax_restricted: ";
- this->Error += cm_archive_error_string(this->Archive);
- return;
- }
- break;
- case Type7Zip:
- if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK)
- {
- this->Error = "archive_write_set_format_7zip: ";
- this->Error += cm_archive_error_string(this->Archive);
- return;
- }
- break;
+ this->Error = "archive_write_set_format_by_name: ";
+ this->Error += cm_archive_error_string(this->Archive);
+ return;
}
// do not pad the last block!!
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 17357b4..794cb28 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -38,16 +38,10 @@ public:
CompressXZ
};
- /** Archive Type */
- enum Type
- {
- TypeTAR,
- TypeZIP,
- Type7Zip
- };
-
/** Construct with output stream to which to write archive. */
- cmArchiveWrite(std::ostream& os, Compress c = CompressNone, Type = TypeTAR);
+ cmArchiveWrite(std::ostream& os, Compress c = CompressNone,
+ std::string const& format = "paxr");
+
~cmArchiveWrite();
/**
diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx
index 4274d85..1184514 100644
--- a/Source/cmBootstrapCommands1.cxx
+++ b/Source/cmBootstrapCommands1.cxx
@@ -42,7 +42,6 @@
#include "cmEndWhileCommand.cxx"
#include "cmExecProgramCommand.cxx"
#include "cmExecuteProcessCommand.cxx"
-#include "cmExternalMakefileProjectGenerator.cxx"
#include "cmFindBase.cxx"
#include "cmFindCommon.cxx"
#include "cmFileCommand.cxx"
@@ -56,7 +55,7 @@
#include "cmPathLabel.cxx"
#include "cmSearchPath.cxx"
-void GetBootstrapCommands1(std::list<cmCommand*>& commands)
+void GetBootstrapCommands1(std::vector<cmCommand*>& commands)
{
commands.push_back(new cmAddCustomCommandCommand);
commands.push_back(new cmAddCustomTargetCommand);
diff --git a/Source/cmBootstrapCommands2.cxx b/Source/cmBootstrapCommands2.cxx
index 5675295..e522d8c 100644
--- a/Source/cmBootstrapCommands2.cxx
+++ b/Source/cmBootstrapCommands2.cxx
@@ -16,7 +16,6 @@
#include "cmCommands.h"
#include "cmConditionEvaluator.cxx"
#include "cmExpandedCommandArgument.cxx"
-#include "cmGeneratorExpressionEvaluationFile.cxx"
#include "cmGetCMakePropertyCommand.cxx"
#include "cmGetDirectoryPropertyCommand.cxx"
#include "cmGetFilenameComponentCommand.cxx"
@@ -60,7 +59,7 @@
#include "cmUnsetCommand.cxx"
#include "cmWhileCommand.cxx"
-void GetBootstrapCommands2(std::list<cmCommand*>& commands)
+void GetBootstrapCommands2(std::vector<cmCommand*>& commands)
{
commands.push_back(new cmGetCMakePropertyCommand);
commands.push_back(new cmGetDirectoryPropertyCommand);
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 5d32437..cdca792 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -147,6 +147,6 @@ bool cmBuildCommand
makecommand.c_str(),
"Command used to build entire project "
"from the command line.",
- cmCacheManager::STRING);
+ cmState::STRING);
return true;
}
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 171ed0f..2a06574 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -39,7 +39,7 @@ bool cmBuildNameCommand
this->Makefile->AddCacheDefinition(args[0],
cv.c_str(),
"Name of build.",
- cmCacheManager::STRING);
+ cmState::STRING);
}
return true;
}
@@ -74,7 +74,7 @@ bool cmBuildNameCommand
this->Makefile->AddCacheDefinition(args[0],
buildname.c_str(),
"Name of build.",
- cmCacheManager::STRING);
+ cmState::STRING);
return true;
}
diff --git a/Source/cmCLocaleEnvironmentScope.cxx b/Source/cmCLocaleEnvironmentScope.cxx
new file mode 100644
index 0000000..5792302
--- /dev/null
+++ b/Source/cmCLocaleEnvironmentScope.cxx
@@ -0,0 +1,67 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 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 "cmCLocaleEnvironmentScope.h"
+
+#include "cmSystemTools.h"
+
+#include <sstream>
+
+cmCLocaleEnvironmentScope::cmCLocaleEnvironmentScope()
+{
+ this->SetEnv("LANGUAGE", "");
+ this->SetEnv("LC_MESSAGES", "C");
+
+ std::string lcAll = this->GetEnv("LC_ALL");
+
+ if(!lcAll.empty())
+ {
+ this->SetEnv("LC_ALL", "");
+ this->SetEnv("LC_CTYPE", lcAll);
+ }
+}
+
+std::string cmCLocaleEnvironmentScope::GetEnv(std::string const& key)
+{
+ const char* value = cmSystemTools::GetEnv(key);
+ return value ? value : std::string();
+}
+
+void cmCLocaleEnvironmentScope::SetEnv(
+ std::string const& key, std::string const& value)
+{
+ std::string oldValue = this->GetEnv(key);
+
+ this->EnvironmentBackup.insert(std::make_pair(key, oldValue));
+
+ if(value.empty())
+ {
+ cmSystemTools::UnsetEnv(key.c_str());
+ }
+ else
+ {
+ std::stringstream tmp;
+ tmp << key << "=" << value;
+ cmSystemTools::PutEnv(tmp.str());
+ }
+}
+
+cmCLocaleEnvironmentScope::~cmCLocaleEnvironmentScope()
+{
+ for(backup_map_t::const_iterator i = this->EnvironmentBackup.begin();
+ i != this->EnvironmentBackup.end(); ++i)
+ {
+ std::stringstream tmp;
+ tmp << i->first << "=" << i->second;
+ cmSystemTools::PutEnv(tmp.str());
+ }
+}
diff --git a/Source/cmCLocaleEnvironmentScope.h b/Source/cmCLocaleEnvironmentScope.h
new file mode 100644
index 0000000..b011741
--- /dev/null
+++ b/Source/cmCLocaleEnvironmentScope.h
@@ -0,0 +1,32 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 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 cmCLocaleEnvironmentScope_h
+#define cmCLocaleEnvironmentScope_h
+
+#include "cmStandardIncludes.h"
+
+class cmCLocaleEnvironmentScope
+{
+public:
+ cmCLocaleEnvironmentScope();
+ ~cmCLocaleEnvironmentScope();
+
+private:
+ std::string GetEnv(std::string const& key);
+ void SetEnv(std::string const& key, std::string const& value);
+
+ typedef std::map<std::string, std::string> backup_map_t;
+ backup_map_t EnvironmentBackup;
+};
+
+#endif
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 691d80d..77cd6c6 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -51,12 +51,14 @@ void CCONV cmSetError(void *info, const char *err)
unsigned int CCONV cmGetCacheMajorVersion(void *arg)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
- return mf->GetCacheMajorVersion();
+ cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
+ return manager->GetCacheMajorVersion();
}
unsigned int CCONV cmGetCacheMinorVersion(void *arg)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
- return mf->GetCacheMinorVersion();
+ cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
+ return manager->GetCacheMinorVersion();
}
unsigned int CCONV cmGetMajorVersion(void *)
@@ -85,27 +87,27 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name,
{
case CM_CACHE_BOOL:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::BOOL);
+ cmState::BOOL);
break;
case CM_CACHE_PATH:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::PATH);
+ cmState::PATH);
break;
case CM_CACHE_FILEPATH:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
break;
case CM_CACHE_STRING:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::STRING);
+ cmState::STRING);
break;
case CM_CACHE_INTERNAL:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
break;
case CM_CACHE_STATIC:
mf->AddCacheDefinition(name,value,doc,
- cmCacheManager::STATIC);
+ cmState::STATIC);
break;
}
}
@@ -162,7 +164,7 @@ int CCONV cmIsOn(void *arg, const char* name)
int CCONV cmCommandExists(void *arg, const char* name)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
- return static_cast<int>(mf->CommandExists(name));
+ return static_cast<int>(mf->GetState()->GetCommand(name) ? 1 : 0);
}
void CCONV cmAddDefineFlag(void *arg, const char* definition)
@@ -865,7 +867,7 @@ void CCONV DefineSourceFileProperty (void *arg, const char *name,
int chained)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
- mf->GetCMakeInstance()->DefineProperty(name,cmProperty::SOURCE_FILE,
+ mf->GetState()->DefineProperty(name,cmProperty::SOURCE_FILE,
briefDocs, longDocs,
chained != 0);
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index df61fe6..cd2cd7c 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -27,6 +27,7 @@
#include "cmCTestCommand.h"
#include "cmCTestStartCommand.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
#include "cmCTestBuildHandler.h"
#include "cmCTestBuildAndTestHandler.h"
@@ -1558,12 +1559,14 @@ void cmCTest::AddSiteProperties(std::ostream& ostr)
return;
}
// This code should go when cdash is changed to use labels only
- const char* subproject = cm->GetProperty("SubProject", cmProperty::GLOBAL);
+ const char* subproject = cm->GetState()
+ ->GetGlobalProperty("SubProject");
if(subproject)
{
ostr << "<Subproject name=\"" << subproject << "\">\n";
const char* labels =
- ch->GetCMake()->GetProperty("SubProjectLabels", cmProperty::GLOBAL);
+ ch->GetCMake()->GetState()
+ ->GetGlobalProperty("SubProjectLabels");
if(labels)
{
ostr << " <Labels>\n";
@@ -1581,7 +1584,7 @@ void cmCTest::AddSiteProperties(std::ostream& ostr)
}
// This code should stay when cdash only does label based sub-projects
- const char* label = cm->GetProperty("Label", cmProperty::GLOBAL);
+ const char* label = cm->GetState()->GetGlobalProperty("Label");
if(label)
{
ostr << "<Labels>\n";
@@ -2279,9 +2282,9 @@ bool cmCTest::AddVariableDefinition(const std::string &arg)
{
std::string name;
std::string value;
- cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+ cmState::CacheEntryType type = cmState::UNINITIALIZED;
- if (cmCacheManager::ParseEntry(arg, name, value, type))
+ if (cmake::ParseCacheEntry(arg, name, value, type))
{
this->Definitions[name] = value;
return true;
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index b8dfe04..289d0dc 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -22,17 +22,6 @@
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
-const char* cmCacheManagerTypes[] =
-{ "BOOL",
- "PATH",
- "FILEPATH",
- "STRING",
- "INTERNAL",
- "STATIC",
- "UNINITIALIZED",
- 0
-};
-
cmCacheManager::cmCacheManager(cmake* cm)
{
this->CacheMajorVersion = 0;
@@ -40,41 +29,6 @@ cmCacheManager::cmCacheManager(cmake* cm)
this->CMakeInstance = cm;
}
-const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type)
-{
- if ( type > 6 )
- {
- return cmCacheManagerTypes[6];
- }
- return cmCacheManagerTypes[type];
-}
-
-cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s)
-{
- int i = 0;
- while(cmCacheManagerTypes[i])
- {
- if(strcmp(s, cmCacheManagerTypes[i]) == 0)
- {
- return static_cast<CacheEntryType>(i);
- }
- ++i;
- }
- return STRING;
-}
-
-bool cmCacheManager::IsType(const char* s)
-{
- for(int i=0; cmCacheManagerTypes[i]; ++i)
- {
- if(strcmp(s, cmCacheManagerTypes[i]) == 0)
- {
- return true;
- }
- }
- return false;
-}
-
bool cmCacheManager::LoadCache(const std::string& path)
{
std::set<std::string> emptySet;
@@ -122,7 +76,7 @@ static bool ParseEntryWithoutType(const std::string& entry,
bool cmCacheManager::ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
- CacheEntryType& type)
+ cmState::CacheEntryType& type)
{
// input line is: key:type=value
static cmsys::RegularExpression reg(
@@ -134,14 +88,14 @@ bool cmCacheManager::ParseEntry(const std::string& entry,
if(regQuoted.find(entry))
{
var = regQuoted.match(1);
- type = cmCacheManager::StringToType(regQuoted.match(2).c_str());
+ type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str());
value = regQuoted.match(3);
flag = true;
}
else if (reg.find(entry))
{
var = reg.match(1);
- type = cmCacheManager::StringToType(reg.match(2).c_str());
+ type = cmState::StringToCacheEntryType(reg.match(2).c_str());
value = reg.match(3);
flag = true;
}
@@ -250,7 +204,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
// If the entry is not internal to the cache being loaded
// or if it is in the list of internal entries to be
// imported, load it.
- if ( internal || (e.Type != INTERNAL) ||
+ if ( internal || (e.Type != cmState::INTERNAL) ||
(includes.find(entryKey) != includes.end()) )
{
// If we are loading the cache from another project,
@@ -258,7 +212,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
// not visible in the gui
if (!internal)
{
- e.Type = INTERNAL;
+ e.Type = cmState::INTERNAL;
helpString = "DO NOT EDIT, ";
helpString += entryKey;
helpString += " loaded from external file. "
@@ -283,14 +237,16 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
this->CacheMajorVersion = 0;
this->CacheMinorVersion = 0;
- if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
+ if(const char* cmajor =
+ this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
{
unsigned int v=0;
if(sscanf(cmajor, "%u", &v) == 1)
{
this->CacheMajorVersion = v;
}
- if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
+ if(const char* cminor =
+ this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION"))
{
if(sscanf(cminor, "%u", &v) == 1)
{
@@ -304,18 +260,19 @@ bool cmCacheManager::LoadCache(const std::string& path,
// Set as version 0.0
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0",
"Minor version of cmake used to create the "
- "current loaded cache", cmCacheManager::INTERNAL);
+ "current loaded cache", cmState::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0",
"Major version of cmake used to create the "
- "current loaded cache", cmCacheManager::INTERNAL);
+ "current loaded cache", cmState::INTERNAL);
}
// check to make sure the cache directory has not
// been moved
- if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+ const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
+ if (internal && oldDir)
{
std::string currentcwd = path;
- std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
+ std::string oldcwd = oldDir;
cmSystemTools::ConvertToUnixSlashes(currentcwd);
currentcwd += "/CMakeCache.txt";
oldcwd += "/CMakeCache.txt";
@@ -324,7 +281,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
std::string message =
std::string("The current CMakeCache.txt directory ") +
currentcwd + std::string(" is different than the directory ") +
- std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
+ std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
std::string(" where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt");
@@ -348,7 +305,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
CacheEntry& e)
{
// All property entries are internal.
- if(e.Type != cmCacheManager::INTERNAL)
+ if(e.Type != cmState::INTERNAL)
{
return false;
}
@@ -367,7 +324,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
// Create an entry and store the property.
CacheEntry& ne = this->Cache[key];
ne.Properties.SetCMakeInstance(this->CMakeInstance);
- ne.Type = cmCacheManager::UNINITIALIZED;
+ ne.Type = cmState::UNINITIALIZED;
ne.SetProperty(*p, e.Value.c_str());
}
else
@@ -424,15 +381,15 @@ bool cmCacheManager::SaveCache(const std::string& path)
sprintf(temp, "%d", cmVersion::GetMinorVersion());
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
"Minor version of cmake used to create the "
- "current loaded cache", cmCacheManager::INTERNAL);
+ "current loaded cache", cmState::INTERNAL);
sprintf(temp, "%d", cmVersion::GetMajorVersion());
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
"Major version of cmake used to create the "
- "current loaded cache", cmCacheManager::INTERNAL);
+ "current loaded cache", cmState::INTERNAL);
sprintf(temp, "%d", cmVersion::GetPatchVersion());
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
"Patch version of cmake used to create the "
- "current loaded cache", cmCacheManager::INTERNAL);
+ "current loaded cache", cmState::INTERNAL);
// Let us store the current working directory so that if somebody
// Copies it, he will not be surprised
@@ -447,7 +404,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
cmSystemTools::ConvertToUnixSlashes(currentcwd);
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
"This is the directory where this CMakeCache.txt"
- " was created", cmCacheManager::INTERNAL);
+ " was created", cmState::INTERNAL);
fout << "# This is the CMakeCache file.\n"
<< "# For build in directory: " << currentcwd << "\n";
@@ -481,7 +438,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
this->Cache.begin(); i != this->Cache.end(); ++i)
{
const CacheEntry& ce = (*i).second;
- CacheEntryType t = ce.Type;
+ cmState::CacheEntryType t = ce.Type;
if(!ce.Initialized)
{
/*
@@ -490,7 +447,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
"\" is uninitialized");
*/
}
- else if(t != INTERNAL)
+ else if(t != cmState::INTERNAL)
{
// Format is key:type=value
if(const char* help = ce.GetProperty("HELPSTRING"))
@@ -502,7 +459,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
cmCacheManager::OutputHelpString(fout, "Missing description");
}
this->OutputKey(fout, i->first);
- fout << ":" << cmCacheManagerTypes[t] << "=";
+ fout << ":" << cmState::CacheEntryTypeToString(t) << "=";
this->OutputValue(fout, ce.Value);
fout << "\n\n";
}
@@ -522,9 +479,9 @@ bool cmCacheManager::SaveCache(const std::string& path)
continue;
}
- CacheEntryType t = i.GetType();
+ cmState::CacheEntryType t = i.GetType();
this->WritePropertyEntries(fout, i);
- if(t == cmCacheManager::INTERNAL)
+ if(t == cmState::INTERNAL)
{
// Format is key:type=value
if(const char* help = i.GetProperty("HELPSTRING"))
@@ -532,7 +489,7 @@ bool cmCacheManager::SaveCache(const std::string& path)
this->OutputHelpString(fout, help);
}
this->OutputKey(fout, i.GetName());
- fout << ":" << cmCacheManagerTypes[t] << "=";
+ fout << ":" << cmState::CacheEntryTypeToString(t) << "=";
this->OutputValue(fout, i.GetValue());
fout << "\n";
}
@@ -654,7 +611,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
return CacheIterator(*this, key);
}
-const char* cmCacheManager::GetCacheValue(const std::string& key) const
+const char*
+cmCacheManager::GetInitializedCacheValue(const std::string& key) const
{
CacheEntryMap::const_iterator i = this->Cache.find(key);
if(i != this->Cache.end() &&
@@ -673,7 +631,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
for(std::map<std::string, CacheEntry>::const_iterator i =
this->Cache.begin(); i != this->Cache.end(); ++i)
{
- if((*i).second.Type != INTERNAL)
+ if((*i).second.Type != cmState::INTERNAL)
{
out << (*i).first << " = " << (*i).second.Value
<< std::endl;
@@ -689,7 +647,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const
void cmCacheManager::AddCacheEntry(const std::string& key,
const char* value,
const char* helpString,
- CacheEntryType type)
+ cmState::CacheEntryType type)
{
CacheEntry& e = this->Cache[key];
e.Properties.SetCMakeInstance(this->CMakeInstance);
@@ -704,7 +662,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key,
}
e.Type = type;
// make sure we only use unix style paths
- if(type == FILEPATH || type == PATH)
+ if(type == cmState::FILEPATH || type == cmState::PATH)
{
if(e.Value.find(';') != e.Value.npos)
{
@@ -785,7 +743,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
{
if(prop == "TYPE")
{
- return cmCacheManagerTypes[this->Type];
+ return cmState::CacheEntryTypeToString(this->Type);
}
else if(prop == "VALUE")
{
@@ -802,7 +760,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
{
if(prop == "TYPE")
{
- this->Type = cmCacheManager::StringToType(value? value : "STRING");
+ this->Type = cmState::StringToCacheEntryType(value? value : "STRING");
}
else if(prop == "VALUE")
{
@@ -821,7 +779,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
{
if(prop == "TYPE")
{
- this->Type = cmCacheManager::StringToType(value? value : "STRING");
+ this->Type = cmState::StringToCacheEntryType(value? value : "STRING");
}
else if(prop == "VALUE")
{
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f7f8776..8462259 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -14,6 +14,8 @@
#include "cmStandardIncludes.h"
#include "cmPropertyMap.h"
+#include "cmState.h"
+
class cmMakefile;
class cmMarkAsAdvancedCommand;
class cmake;
@@ -30,21 +32,22 @@ public:
cmCacheManager(cmake* cm);
class CacheIterator;
friend class cmCacheManager::CacheIterator;
- enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
- UNINITIALIZED };
private:
struct CacheEntry
{
std::string Value;
- CacheEntryType Type;
+ cmState::CacheEntryType Type;
cmPropertyMap Properties;
const char* GetProperty(const std::string&) const;
void SetProperty(const std::string& property, const char* value);
void AppendProperty(const std::string& property, const char* value,
bool asString=false);
bool Initialized;
- CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false)
+ CacheEntry()
+ : Value(""),
+ Type(cmState::UNINITIALIZED),
+ Initialized(false)
{}
};
@@ -65,11 +68,13 @@ public:
void AppendProperty(const std::string& property, const char* value,
bool asString=false);
void SetProperty(const std::string& property, bool value);
- std::string GetValue() const { return this->GetEntry().Value; }
+ const char* GetValue() const { return this->GetEntry().Value.c_str(); }
bool GetValueAsBool() const;
void SetValue(const char*);
- CacheEntryType GetType() const { return this->GetEntry().Type; }
- void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; }
+ cmState::CacheEntryType GetType() const
+ { return this->GetEntry().Type; }
+ void SetType(cmState::CacheEntryType ty)
+ { this->GetEntry().Type = ty; }
bool Initialized() { return this->GetEntry().Initialized; }
cmCacheManager &Container;
std::map<std::string, CacheEntry>::iterator Position;
@@ -94,17 +99,6 @@ public:
return CacheIterator(*this);
}
- /**
- * Types for the cache entries. These are useful as
- * hints for a cache editor program. Path should bring
- * up a file chooser, BOOL a check box, and STRING a
- * text entry box, FILEPATH is a full path to a file which
- * can be different than just a path input
- */
- static CacheEntryType StringToType(const char*);
- static const char* TypeToString(CacheEntryType);
- static bool IsType(const char*);
-
///! Load a cache for given makefile. Loads from path/CMakeCache.txt.
bool LoadCache(const std::string& path);
bool LoadCache(const std::string& path, bool internal,
@@ -134,10 +128,85 @@ public:
static bool ParseEntry(const std::string& entry,
std::string& var,
std::string& value,
- CacheEntryType& type);
+ cmState::CacheEntryType& type);
///! Get a value from the cache given a key
- const char* GetCacheValue(const std::string& key) const;
+ const char* GetInitializedCacheValue(const std::string& key) const;
+
+ const char* GetCacheEntryValue(const std::string& key)
+ {
+ cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
+ if (it.IsAtEnd())
+ {
+ return 0;
+ }
+ return it.GetValue();
+ }
+
+ const char* GetCacheEntryProperty(std::string const& key,
+ std::string const& propName)
+ {
+ return this->GetCacheIterator(key.c_str()).GetProperty(propName);
+ }
+
+ cmState::CacheEntryType GetCacheEntryType(std::string const& key)
+ {
+ return this->GetCacheIterator(key.c_str()).GetType();
+ }
+
+ bool GetCacheEntryPropertyAsBool(std::string const& key,
+ std::string const& propName)
+ {
+ return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName);
+ }
+
+ void SetCacheEntryProperty(std::string const& key,
+ std::string const& propName,
+ std::string const& value)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str());
+ }
+
+ void SetCacheEntryBoolProperty(std::string const& key,
+ std::string const& propName,
+ bool value)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, value);
+ }
+
+ void SetCacheEntryValue(std::string const& key,
+ std::string const& value)
+ {
+ this->GetCacheIterator(key.c_str()).SetValue(value.c_str());
+ }
+
+ void RemoveCacheEntryProperty(std::string const& key,
+ std::string const& propName)
+ {
+ this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
+ }
+
+ void AppendCacheEntryProperty(std::string const& key,
+ std::string const& propName,
+ std::string const& value,
+ bool asString = false)
+ {
+ this->GetCacheIterator(key.c_str()).AppendProperty(propName,
+ value.c_str(),
+ asString);
+ }
+
+ std::vector<std::string> GetCacheEntryKeys()
+ {
+ std::vector<std::string> definitions;
+ definitions.reserve(this->GetSize());
+ cmCacheManager::CacheIterator cit = this->GetCacheIterator();
+ for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
+ {
+ definitions.push_back(cit.GetName());
+ }
+ return definitions;
+ }
/** Get the version of CMake that wrote the cache. */
unsigned int GetCacheMajorVersion() const
@@ -148,7 +217,8 @@ public:
protected:
///! Add an entry into the cache
void AddCacheEntry(const std::string& key, const char* value,
- const char* helpString, CacheEntryType type);
+ const char* helpString,
+ cmState::CacheEntryType type);
///! Get a cache entry object for a key
CacheEntry *GetCacheEntry(const std::string& key);
@@ -173,9 +243,8 @@ private:
CacheEntryMap Cache;
// Only cmake and cmMakefile should be able to add cache values
// the commands should never use the cmCacheManager directly
- friend class cmMakefile; // allow access to add cache values
+ friend class cmState; // allow access to add cache values
friend class cmake; // allow access to add cache values
- friend class cmMarkAsAdvancedCommand; // allow access to add cache values
};
#endif
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 747b7e4..0d1c86d 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmCommandArgumentLexer.h"
@@ -90,7 +91,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
}
if ( strcmp(key, "CACHE") == 0 )
{
- if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var))
+ if(const char* c = this->Makefile->GetState()
+ ->GetInitializedCacheValue(var))
{
if(this->EscapeQuotes)
{
diff --git a/Source/cmCommands.cxx.in b/Source/cmCommands.cxx.in
index f0745d7..e23bbd1 100644
--- a/Source/cmCommands.cxx.in
+++ b/Source/cmCommands.cxx.in
@@ -13,7 +13,7 @@
@COMMAND_INCLUDES@
-void GetPredefinedCommands(std::list<cmCommand*>& commands)
+void GetPredefinedCommands(std::vector<cmCommand*>& commands)
{
@NEW_COMMANDS@
}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index e902853..7a94423 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -13,7 +13,7 @@
#define cmCommands_h
#include "cmStandardIncludes.h"
-#include <list>
+#include <vector>
class cmCommand;
/**
@@ -23,9 +23,9 @@ class cmCommand;
* It is up to the caller to delete the commands created by this
* call.
*/
-void GetBootstrapCommands1(std::list<cmCommand*>& commands);
-void GetBootstrapCommands2(std::list<cmCommand*>& commands);
-void GetPredefinedCommands(std::list<cmCommand*>& commands);
+void GetBootstrapCommands1(std::vector<cmCommand*>& commands);
+void GetBootstrapCommands2(std::vector<cmCommand*>& commands);
+void GetPredefinedCommands(std::vector<cmCommand*>& commands);
#endif
diff --git a/Source/cmCommandsForBootstrap.cxx b/Source/cmCommandsForBootstrap.cxx
index 15b664e..5f397a1 100644
--- a/Source/cmCommandsForBootstrap.cxx
+++ b/Source/cmCommandsForBootstrap.cxx
@@ -11,6 +11,6 @@
============================================================================*/
#include "cmCommands.h"
-void GetPredefinedCommands(std::list<cmCommand*>&)
+void GetPredefinedCommands(std::vector<cmCommand*>&)
{
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index b0e0f36..83d38ef 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -15,6 +15,7 @@
#include "cmOrderDirectories.h"
#include "cmGlobalGenerator.h"
+#include "cmState.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmTarget.h"
@@ -250,8 +251,8 @@ cmComputeLinkInformation
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// Check whether to recognize OpenBSD-style library versioned names.
- this->OpenBSD = this->Makefile->GetCMakeInstance()
- ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
+ this->OpenBSD = this->Makefile->GetState()
+ ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
// The configuration being linked.
this->Config = config;
@@ -411,6 +412,10 @@ cmComputeLinkInformation
std::vector<std::string> const& dirs = this->Target->GetLinkDirectories();
this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
}
+
+ this->CMP0060Warn =
+ this->Makefile->PolicyOptionalWarningEnabled(
+ "CMAKE_POLICY_WARNING_CMP0060");
}
//----------------------------------------------------------------------------
@@ -548,6 +553,22 @@ bool cmComputeLinkInformation::Compute()
// Add implicit language runtime libraries and directories.
this->AddImplicitLinkInfo();
+ if (!this->CMP0060WarnItems.empty())
+ {
+ std::ostringstream w;
+ w << (this->Makefile->GetCMakeInstance()->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n"
+ "Some library files are in directories implicitly searched by "
+ "the linker when invoked for " << this->LinkLanguage << ":\n"
+ " " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n"
+ "For compatibility with older versions of CMake, the generated "
+ "link line will ask the linker to search for these by library "
+ "name."
+ ;
+ this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
+ this->Target->GetBacktrace());
+ }
+
return true;
}
@@ -776,9 +797,8 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
void cmComputeLinkInformation::ComputeLinkTypeInfo()
{
// Check whether archives may actually be shared libraries.
- this->ArchivesMayBeShared =
- this->CMakeInstance->GetPropertyAsBool(
- "TARGET_ARCHIVES_MAY_BE_SHARED_LIBS");
+ this->ArchivesMayBeShared = this->CMakeInstance->GetState()
+ ->GetGlobalPropertyAsBool("TARGET_ARCHIVES_MAY_BE_SHARED_LIBS");
// First assume we cannot do link type stuff.
this->LinkTypeEnabled = false;
@@ -1190,6 +1210,28 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
return false;
}
+ // Check the policy for whether we should use the approach below.
+ switch (this->Target->GetPolicyStatusCMP0060())
+ {
+ case cmPolicies::WARN:
+ if (this->CMP0060Warn)
+ {
+ // Print the warning at most once for this item.
+ std::string const& wid = "CMP0060-WARNING-GIVEN-" + item;
+ if (!this->CMakeInstance->GetPropertyAsBool(wid))
+ {
+ this->CMakeInstance->SetProperty(wid, "1");
+ this->CMP0060WarnItems.insert(item);
+ }
+ }
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ return false;
+ }
+
// Many system linkers support multiple architectures by
// automatically selecting the implicit linker search path for the
// current architecture. If the library appears in an implicit link
@@ -1485,9 +1527,10 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
// Print the warning at most once for this item.
std::string wid = "CMP0008-WARNING-GIVEN-";
wid += item;
- if(!this->CMakeInstance->GetPropertyAsBool(wid))
+ if(!this->CMakeInstance->GetState()
+ ->GetGlobalPropertyAsBool(wid))
{
- this->CMakeInstance->SetProperty(wid, "1");
+ this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
std::ostringstream w;
w << (this->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0008)) << "\n"
@@ -1534,9 +1577,11 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
switch(this->Target->GetPolicyStatusCMP0003())
{
case cmPolicies::WARN:
- if(!this->CMakeInstance->GetPropertyAsBool("CMP0003-WARNING-GIVEN"))
+ if(!this->CMakeInstance->GetState()
+ ->GetGlobalPropertyAsBool("CMP0003-WARNING-GIVEN"))
{
- this->CMakeInstance->SetProperty("CMP0003-WARNING-GIVEN", "1");
+ this->CMakeInstance->GetState()
+ ->SetGlobalProperty("CMP0003-WARNING-GIVEN", "1");
std::ostringstream w;
this->PrintLinkPolicyDiagnosis(w);
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index e5d674a..8847141 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -175,6 +175,10 @@ private:
std::vector<std::string> OldUserFlagItems;
bool OldLinkDirMode;
+ // CMP0060 warnings.
+ bool CMP0060Warn;
+ std::set<std::string> CMP0060WarnItems;
+
// Runtime path computation.
cmOrderDirectories* OrderRuntimeSearchPath;
void AddLibraryRuntimeInfo(std::string const& fullPath,
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index bbffd5d..11056cd 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -15,6 +15,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmSourceFile.h"
#include "cmTarget.h"
@@ -98,8 +99,10 @@ cmComputeTargetDepends::cmComputeTargetDepends(cmGlobalGenerator* gg)
{
this->GlobalGenerator = gg;
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
- this->DebugMode = cm->GetPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE");
- this->NoCycles = cm->GetPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES");
+ this->DebugMode = cm->GetState()
+ ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_DEBUG_MODE");
+ this->NoCycles = cm->GetState()
+ ->GetGlobalPropertyAsBool("GLOBAL_DEPENDS_NO_CYCLES");
}
//----------------------------------------------------------------------------
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index eb4f3a1..0a71c60 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -481,8 +481,10 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs,
// does a command exist
if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end())
{
+ cmCommand* command =
+ this->Makefile.GetState()->GetCommand(argP1->c_str());
this->HandlePredicate(
- this->Makefile.CommandExists(argP1->c_str()),
+ command ? true : false,
reducible, arg, newArgs, argP1, argP2);
}
// does a policy exist
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 59efa52..56a884c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmCoreTryCompile.h"
#include "cmake.h"
-#include "cmCacheManager.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmAlgorithms.h"
@@ -527,7 +526,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
this->Makefile->AddCacheDefinition(argv[0],
(res == 0 ? "TRUE" : "FALSE"),
"Result of TRY_COMPILE",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
if (!outputVariable.empty())
{
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 5ff0186..0efc7fc 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmDefinePropertyCommand.h"
#include "cmake.h"
+#include "cmState.h"
bool cmDefinePropertyCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@@ -127,7 +128,7 @@ bool cmDefinePropertyCommand
}
// Actually define the property.
- this->Makefile->GetCMakeInstance()->DefineProperty
+ this->Makefile->GetState()->DefineProperty
(this->PropertyName, scope,
this->BriefDocs.c_str(), this->FullDocs.c_str(), inherited);
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8c17536..4f34755 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -138,6 +138,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
return this->PrintHelpListVariables(os);
case cmDocumentation::ListPolicies:
return this->PrintHelpListPolicies(os);
+ case cmDocumentation::ListGenerators:
+ return this->PrintHelpListGenerators(os);
case cmDocumentation::Version:
return this->PrintVersion(os);
case cmDocumentation::OldCustomModules:
@@ -817,6 +819,19 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os)
}
//----------------------------------------------------------------------------
+bool cmDocumentation::PrintHelpListGenerators(std::ostream& os)
+{
+ std::map<std::string,cmDocumentationSection*>::iterator si;
+ si = this->AllSections.find("Generators");
+ if(si != this->AllSections.end())
+ {
+ this->Formatter.SetIndent(" ");
+ this->Formatter.PrintSection(os, *si->second);
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmDocumentation::PrintHelpOneVariable(std::ostream& os)
{
std::string vname = cmSystemTools::HelpFileName(this->CurrentArgument);
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index b72b5fe..8854c36 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -117,6 +117,7 @@ private:
bool PrintHelpListProperties(std::ostream& os);
bool PrintHelpListVariables(std::ostream& os);
bool PrintHelpListPolicies(std::ostream& os);
+ bool PrintHelpListGenerators(std::ostream& os);
bool PrintOldCustomModules(std::ostream& os);
const char* GetNameString() const;
diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx
index 4de59c0..6869e2f 100644
--- a/Source/cmDocumentationFormatter.cxx
+++ b/Source/cmDocumentationFormatter.cxx
@@ -204,7 +204,7 @@ void cmDocumentationFormatter
if(!op->Name.empty())
{
os << " " << op->Name;
- this->TextIndent = " ";
+ this->TextIndent = " ";
int align = static_cast<int>(strlen(this->TextIndent))-4;
for(int i = static_cast<int>(op->Name.size()); i < align; ++i)
{
diff --git a/Source/cmDocumentationFormatter.h b/Source/cmDocumentationFormatter.h
index 59513cc..6e19b7d 100644
--- a/Source/cmDocumentationFormatter.h
+++ b/Source/cmDocumentationFormatter.h
@@ -26,8 +26,8 @@ public:
/** Types of help provided. */
enum Type
{
- None, Version, Usage, Help, Full, ListManuals,
- ListCommands, ListModules, ListProperties, ListVariables, ListPolicies,
+ None, Version, Usage, Help, Full, ListManuals, ListCommands,
+ ListModules, ListProperties, ListVariables, ListPolicies, ListGenerators,
OneManual, OneCommand, OneModule, OneProperty, OneVariable, OnePolicy,
OldCustomModules
};
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index d64b0d7..2aa4d93 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -16,6 +16,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
+#include "cmState.h"
#include "cmTarget.h"
#include "cmSourceFile.h"
@@ -205,7 +206,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar;
- const char* cacheValue = mf->GetCacheManager()->GetCacheValue(
+ const char* cacheValue = mf->GetState()->GetInitializedCacheValue(
cacheEntryName);
// now we have both, decide which one to use
@@ -221,9 +222,9 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
- cacheEntryName.c_str(), cmCacheManager::STRING,
+ cacheEntryName.c_str(), cmState::STRING,
true);
- mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
+ mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
}
else if (envVarValue==0 && cacheValue!=0)
{
@@ -242,9 +243,9 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
{
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
- cacheEntryName.c_str(), cmCacheManager::STRING,
+ cacheEntryName.c_str(), cmState::STRING,
true);
- mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
+ mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
}
}
@@ -468,8 +469,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
fout << "\t\t<nature>" << *nit << "</nature>\n";
}
- if (const char *extraNaturesProp = mf->GetCMakeInstance()->
- GetProperty("ECLIPSE_EXTRA_NATURES", cmProperty::GLOBAL))
+ if (const char *extraNaturesProp = mf->GetState()
+ ->GetGlobalProperty("ECLIPSE_EXTRA_NATURES"))
{
std::vector<std::string> extraNatures;
cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 93e3ac4..6ac0def 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -15,6 +15,8 @@
#include "cmHexFileConverter.h"
#include "cmInstallType.h"
#include "cmFileTimeComparison.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
#include "cmCryptoHash.h"
#include "cmAlgorithms.h"
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index f63df61..add06a7 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -12,6 +12,7 @@
#include "cmFindBase.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
cmFindBase::cmFindBase()
{
@@ -366,18 +367,18 @@ bool cmFindBase::CheckForVariableInCache()
if(const char* cacheValue =
this->Makefile->GetDefinition(this->VariableName))
{
- cmCacheManager::CacheIterator it =
- this->Makefile->GetCacheManager()->
- GetCacheIterator(this->VariableName.c_str());
+ cmState* state = this->Makefile->GetState();
+ const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
- bool cached = !it.IsAtEnd();
+ bool cached = cacheEntry ? true : false;
if(found)
{
// If the user specifies the entry on the command line without a
// type we should add the type and docstring but keep the
// original value. Tell the subclass implementations to do
// this.
- if(cached && it.GetType() == cmCacheManager::UNINITIALIZED)
+ if(cached && state->GetCacheEntryType(this->VariableName)
+ == cmState::UNINITIALIZED)
{
this->AlreadyInCacheWithoutMetaInfo = true;
}
@@ -385,7 +386,8 @@ bool cmFindBase::CheckForVariableInCache()
}
else if(cached)
{
- const char* hs = it.GetProperty("HELPSTRING");
+ const char* hs = state->GetCacheEntryProperty(this->VariableName,
+ "HELPSTRING");
this->VariableDocumentation = hs?hs:"(none)";
}
}
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index c499f61..507d011 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmFindLibraryCommand.h"
-#include "cmCacheManager.h"
#include <cmsys/Directory.hxx>
#include <cmsys/stl/algorithm>
@@ -39,7 +38,7 @@ bool cmFindLibraryCommand
{
this->Makefile->AddCacheDefinition(this->VariableName, "",
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
}
return true;
}
@@ -55,8 +54,8 @@ bool cmFindLibraryCommand
}
}
- if(this->Makefile->GetCMakeInstance()
- ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
+ if(this->Makefile->GetState()
+ ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
{
// add special 64 bit paths if this is a 64 bit compile.
if(this->Makefile->PlatformIs64Bit())
@@ -72,14 +71,14 @@ bool cmFindLibraryCommand
this->Makefile->AddCacheDefinition(this->VariableName,
library.c_str(),
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
return true;
}
std::string notfound = this->VariableName + "-NOTFOUND";
this->Makefile->AddCacheDefinition(this->VariableName,
notfound.c_str(),
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
return true;
}
@@ -227,8 +226,8 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf):
// Check whether to use OpenBSD-style library version comparisons.
this->OpenBSD =
- this->Makefile->GetCMakeInstance()
- ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
+ this->Makefile->GetState()
+ ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING");
}
//----------------------------------------------------------------------------
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 4d7fd60..e1074b0 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -120,8 +120,8 @@ bool cmFindPackageCommand
// Lookup whether lib64 paths should be used.
if(this->Makefile->PlatformIs64Bit() &&
- this->Makefile->GetCMakeInstance()
- ->GetPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
+ this->Makefile->GetState()
+ ->GetGlobalPropertyAsBool("FIND_LIBRARY_USE_LIB64_PATHS"))
{
this->UseLib64Paths = true;
}
@@ -947,7 +947,7 @@ bool cmFindPackageCommand::FindConfig()
// We force the value since we do not get here if it was already set.
this->Makefile->AddCacheDefinition(this->Variable,
init.c_str(), help.c_str(),
- cmCacheManager::PATH, true);
+ cmState::PATH, true);
return found;
}
@@ -1015,8 +1015,8 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
void cmFindPackageCommand::AppendToFoundProperty(bool found)
{
std::vector<std::string> foundContents;
- const char *foundProp =
- this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_FOUND");
+ const char *foundProp = this->Makefile->GetState()
+ ->GetGlobalProperty("PACKAGES_FOUND");
if (foundProp && *foundProp)
{
std::string tmp = foundProp;
@@ -1032,7 +1032,8 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
std::vector<std::string> notFoundContents;
const char *notFoundProp =
- this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_NOT_FOUND");
+ this->Makefile->GetState()
+ ->GetGlobalProperty("PACKAGES_NOT_FOUND");
if (notFoundProp && *notFoundProp)
{
std::string tmp = notFoundProp;
@@ -1057,12 +1058,12 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
std::string tmp = cmJoin(foundContents, ";");
- this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND",
- tmp.c_str());
+ this->Makefile->GetState()
+ ->SetGlobalProperty("PACKAGES_FOUND", tmp.c_str());
tmp = cmJoin(notFoundContents, ";");
- this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
- tmp.c_str());
+ this->Makefile->GetState()
+ ->SetGlobalProperty("PACKAGES_NOT_FOUND", tmp.c_str());
}
//----------------------------------------------------------------------------
@@ -1071,8 +1072,8 @@ void cmFindPackageCommand::AppendSuccessInformation()
{
std::string transitivePropName = "_CMAKE_";
transitivePropName += this->Name + "_TRANSITIVE_DEPENDENCY";
- this->Makefile->GetCMakeInstance()
- ->SetProperty(transitivePropName, "False");
+ this->Makefile->GetState()
+ ->SetGlobalProperty(transitivePropName, "False");
}
std::string found = this->Name;
found += "_FOUND";
@@ -1090,8 +1091,8 @@ void cmFindPackageCommand::AppendSuccessInformation()
std::string quietInfoPropName = "_CMAKE_";
quietInfoPropName += this->Name;
quietInfoPropName += "_QUIET";
- this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName,
- this->Quiet ? "TRUE" : "FALSE");
+ this->Makefile->GetState()
+ ->SetGlobalProperty(quietInfoPropName, this->Quiet ? "TRUE" : "FALSE");
// set a global property to record the required version of this package
std::string versionInfoPropName = "_CMAKE_";
@@ -1104,15 +1105,15 @@ void cmFindPackageCommand::AppendSuccessInformation()
versionInfo += " ";
versionInfo += this->Version;
}
- this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName,
- versionInfo.c_str());
+ this->Makefile->GetState()
+ ->SetGlobalProperty(versionInfoPropName, versionInfo.c_str());
if (this->Required)
{
std::string requiredInfoPropName = "_CMAKE_";
requiredInfoPropName += this->Name;
requiredInfoPropName += "_TYPE";
- this->Makefile->GetCMakeInstance()->SetProperty(
- requiredInfoPropName, "REQUIRED");
+ this->Makefile->GetState()
+ ->SetGlobalProperty(requiredInfoPropName, "REQUIRED");
}
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 49fbf45..1f3d1a4 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmFindPathCommand.h"
-#include "cmCacheManager.h"
#include <cmsys/Glob.hxx>
@@ -41,7 +40,7 @@ bool cmFindPathCommand
this->VariableName, "",
this->VariableDocumentation.c_str(),
(this->IncludeFileInPath ?
- cmCacheManager::FILEPATH :cmCacheManager::PATH)
+ cmState::FILEPATH :cmState::PATH)
);
}
return true;
@@ -54,7 +53,7 @@ bool cmFindPathCommand
(this->VariableName, result.c_str(),
this->VariableDocumentation.c_str(),
(this->IncludeFileInPath) ?
- cmCacheManager::FILEPATH :cmCacheManager::PATH);
+ cmState::FILEPATH :cmState::PATH);
return true;
}
this->Makefile->AddCacheDefinition
@@ -62,7 +61,7 @@ bool cmFindPathCommand
(this->VariableName + "-NOTFOUND").c_str(),
this->VariableDocumentation.c_str(),
(this->IncludeFileInPath) ?
- cmCacheManager::FILEPATH :cmCacheManager::PATH);
+ cmState::FILEPATH :cmState::PATH);
return true;
}
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 4ee419c..fbd9fd3 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmFindProgramCommand.h"
-#include "cmCacheManager.h"
#include <stdlib.h>
#if defined(__APPLE__)
@@ -37,7 +36,7 @@ bool cmFindProgramCommand
{
this->Makefile->AddCacheDefinition(this->VariableName, "",
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
}
return true;
}
@@ -49,14 +48,14 @@ bool cmFindProgramCommand
this->Makefile->AddCacheDefinition(this->VariableName,
result.c_str(),
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
return true;
}
this->Makefile->AddCacheDefinition(this->VariableName,
(this->VariableName + "-NOTFOUND").c_str(),
this->VariableDocumentation.c_str(),
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
return true;
}
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 9297688..fdd1018 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -193,9 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
}
std::string newName = "_" + this->Args[0];
- mf.GetCMakeInstance()->RenameCommand(this->Args[0],
- newName);
- mf.AddCommand(f);
+ mf.GetState()->RenameCommand(this->Args[0], newName);
+ mf.GetState()->AddCommand(f);
// remove the function blocker now that the function is defined
mf.RemoveFunctionBlocker(this, lff);
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 85aa31f..b035750 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -14,6 +14,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmake.h"
+#include "cmState.h"
#include "cmAlgorithms.h"
// cmGetCMakePropertyCommand
@@ -53,7 +54,8 @@ bool cmGetCMakePropertyCommand
else
{
const char *prop =
- this->Makefile->GetCMakeInstance()->GetProperty(args[1]);
+ this->Makefile->GetState()
+ ->GetGlobalProperty(args[1]);
if (prop)
{
output = prop;
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 9aceb39..6947a7f 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -117,13 +117,13 @@ bool cmGetFilenameComponentCommand
{
this->Makefile->AddCacheDefinition
(storeArgs, programArgs.c_str(),
- "", args[2] == "PATH" ? cmCacheManager::FILEPATH
- : cmCacheManager::STRING);
+ "", args[2] == "PATH" ? cmState::FILEPATH
+ : cmState::STRING);
}
this->Makefile->AddCacheDefinition
(args[0], result.c_str(), "",
- args[2] == "PATH" ? cmCacheManager::FILEPATH
- : cmCacheManager::STRING);
+ args[2] == "PATH" ? cmState::FILEPATH
+ : cmState::STRING);
}
else
{
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index f0b2686..3e1d08e 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -12,6 +12,7 @@
#include "cmGetPropertyCommand.h"
#include "cmake.h"
+#include "cmState.h"
#include "cmTest.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -142,7 +143,7 @@ bool cmGetPropertyCommand
// Lookup brief documentation.
std::string output;
if(cmPropertyDefinition* def =
- this->Makefile->GetCMakeInstance()->
+ this->Makefile->GetState()->
GetPropertyDefinition(this->PropertyName, scope))
{
output = def->GetShortDescription();
@@ -158,7 +159,7 @@ bool cmGetPropertyCommand
// Lookup full documentation.
std::string output;
if(cmPropertyDefinition* def =
- this->Makefile->GetCMakeInstance()->
+ this->Makefile->GetState()->
GetPropertyDefinition(this->PropertyName, scope))
{
output = def->GetFullDescription();
@@ -172,7 +173,7 @@ bool cmGetPropertyCommand
else if(this->InfoType == OutDefined)
{
// Lookup if the property is defined
- if(this->Makefile->GetCMakeInstance()->
+ if(this->Makefile->GetState()->
GetPropertyDefinition(this->PropertyName, scope))
{
this->Makefile->AddDefinition(this->Variable, "1");
@@ -236,7 +237,8 @@ bool cmGetPropertyCommand::HandleGlobalMode()
// Get the property.
cmake* cm = this->Makefile->GetCMakeInstance();
- return this->StoreResult(cm->GetProperty(this->PropertyName));
+ return this->StoreResult(cm->GetState()
+ ->GetGlobalProperty(this->PropertyName));
}
//----------------------------------------------------------------------------
@@ -391,11 +393,10 @@ bool cmGetPropertyCommand::HandleCacheMode()
}
const char* value = 0;
- cmCacheManager::CacheIterator it =
- this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str());
- if(!it.IsAtEnd())
+ if(this->Makefile->GetState()->GetCacheEntryValue(this->Name))
{
- value = it.GetProperty(this->PropertyName);
+ value = this->Makefile->GetState()
+ ->GetCacheEntryProperty(this->Name, this->PropertyName);
}
this->StoreResult(value);
return true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3c0a0e2..ab044c1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmLocalGenerator.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmake.h"
+#include "cmState.h"
#include "cmMakefile.h"
#include "cmQtAutoGenerators.h"
#include "cmSourceFile.h"
@@ -179,7 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
return;
}
const char* cname = this->GetCMakeInstance()->
- GetCacheManager()->GetCacheValue(langComp);
+ GetState()->GetInitializedCacheValue(langComp);
std::string changeVars;
if(cname && !optional)
{
@@ -199,7 +200,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
if (cnameString != pathString)
{
const char* cvars =
- this->GetCMakeInstance()->GetProperty(
+ this->GetCMakeInstance()->GetState()->GetGlobalProperty(
"__CMAKE_DELETE_CACHE_CHANGE_VARS_");
if(cvars)
{
@@ -209,7 +210,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
changeVars += langComp;
changeVars += ";";
changeVars += cname;
- this->GetCMakeInstance()->SetProperty(
+ this->GetCMakeInstance()->GetState()->SetGlobalProperty(
"__CMAKE_DELETE_CACHE_CHANGE_VARS_",
changeVars.c_str());
}
@@ -310,7 +311,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
makeProgram += saveFile;
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
"make program",
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
}
}
@@ -968,7 +969,7 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l,
void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
cmMakefile* mf)
{
- this->LanguageEnabled[l] = true;
+ this->CMakeInstance->GetState()->SetLanguageEnabled(l);
// Fill the language-to-extension map with the current variable
// settings to make sure it is available for the try_compile()
@@ -1079,12 +1080,12 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const
bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const
{
- return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end());
+ return this->CMakeInstance->GetState()->GetLanguageEnabled(l);
}
void cmGlobalGenerator::ClearEnabledLanguages()
{
- this->LanguageEnabled.clear();
+ return this->CMakeInstance->GetState()->ClearEnabledLanguages();
}
void cmGlobalGenerator::Configure()
@@ -1115,7 +1116,7 @@ void cmGlobalGenerator::Configure()
sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size()));
this->GetCMakeInstance()->AddCacheEntry
("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num,
- "number of local generators", cmCacheManager::INTERNAL);
+ "number of local generators", cmState::INTERNAL);
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
@@ -1169,8 +1170,8 @@ void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
{
// If the property is not enabled then okay.
- if(!this->CMakeInstance
- ->GetPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS"))
+ if(!this->CMakeInstance->GetState()
+ ->GetGlobalPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS"))
{
return true;
}
@@ -1537,7 +1538,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
// after it is all done do a ConfigureFinalPass
- cmCacheManager* manager = this->GetCMakeInstance()->GetCacheManager();
+ cmState* state = this->GetCMakeInstance()->GetState();
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
this->LocalGenerators[i]->ConfigureFinalPass();
@@ -1559,9 +1560,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(lib->first.c_str()))
{
std::string varName = lib->first.substr(0, lib->first.size()-9);
- cmCacheManager::CacheIterator it =
- manager->GetCacheIterator(varName.c_str());
- if(it.GetPropertyAsBool("ADVANCED"))
+ if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{
varName += " (ADVANCED)";
}
@@ -1592,9 +1591,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(incDir->c_str()))
{
std::string varName = incDir->substr(0, incDir->size()-9);
- cmCacheManager::CacheIterator it =
- manager->GetCacheIterator(varName.c_str());
- if(it.GetPropertyAsBool("ADVANCED"))
+ if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{
varName += " (ADVANCED)";
}
@@ -1641,7 +1638,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
// and there is a good chance that the try compile stuff will
// take the bulk of the time, so try and guess some progress
// by getting closer and closer to 100 without actually getting there.
- if (!this->CMakeInstance->GetCacheManager()->GetCacheValue
+ if (!this->CMakeInstance->GetState()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
{
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
@@ -1839,7 +1836,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
// update progress
// estimate how many lg there will be
const char *numGenC =
- this->CMakeInstance->GetCacheManager()->GetCacheValue
+ this->CMakeInstance->GetState()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
if (!numGenC)
@@ -1897,7 +1894,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
"make program",
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
// copy the enabled languages
this->LanguageEnabled = gen->LanguageEnabled;
this->LanguagesReady = gen->LanguagesReady;
@@ -1962,11 +1959,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
void
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
{
- for(std::map<std::string, bool>::const_iterator i =
- this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
- {
- lang.push_back(i->first);
- }
+ lang = this->CMakeInstance->GetState()->GetEnabledLanguages();
}
int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const
@@ -2398,8 +2391,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
//----------------------------------------------------------------------------
const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
{
- const char* prop =
- this->GetCMakeInstance()->GetProperty("PREDEFINED_TARGETS_FOLDER");
+ const char* prop = this->GetCMakeInstance()->GetState()
+ ->GetGlobalProperty("PREDEFINED_TARGETS_FOLDER");
if (prop)
{
@@ -2412,7 +2405,8 @@ const char* cmGlobalGenerator::GetPredefinedTargetsFolder()
//----------------------------------------------------------------------------
bool cmGlobalGenerator::UseFolderProperty()
{
- const char* prop = this->GetCMakeInstance()->GetProperty("USE_FOLDERS");
+ const char* prop = this->GetCMakeInstance()->GetState()
+ ->GetGlobalProperty("USE_FOLDERS");
// If this property is defined, let the setter turn this on or off...
//
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5b9ddee..ce3f037 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -441,7 +441,7 @@ private:
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
std::map<std::string, bool> IgnoreExtensions;
- std::map<std::string, bool> LanguageEnabled;
+ std::vector<std::string> LanguageEnabled;
std::set<std::string> LanguagesReady; // Ready for try_compile
std::map<std::string, std::string> OutputExtensions;
std::map<std::string, std::string> LanguageToOutputExtension;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2ade825..505914e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -507,7 +507,7 @@ void cmGlobalNinjaGenerator
::GetDocumentation(cmDocumentationEntry& entry)
{
entry.Name = cmGlobalNinjaGenerator::GetActualName();
- entry.Brief = "Generates build.ninja files (experimental).";
+ entry.Brief = "Generates build.ninja files.";
}
// Implemented in all cmGlobaleGenerator sub-classes.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 7648813..22d633c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -97,7 +97,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
{
cm->AddCacheEntry
("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
- "Path to cache edit program executable.", cmCacheManager::INTERNAL);
+ "Path to cache edit program executable.", cmState::INTERNAL);
}
}
const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 18d40e1..231b679 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -71,8 +71,11 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.Name = vs10generatorName;
- entry.Brief = "Generates Visual Studio 10 (VS 2010) project files.";
+ entry.Name = std::string(vs10generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2010 project files. "
+ "Optional [arch] can be \"Win64\" or \"IA64\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const
@@ -368,39 +371,6 @@ const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory()
-{
- std::string base;
- std::string path;
-
- // base begins with the VisualStudioProjectsLocation reg value...
- if (cmSystemTools::ReadRegistryValue(
- "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0;"
- "VisualStudioProjectsLocation",
- base))
- {
- cmSystemTools::ConvertToUnixSlashes(base);
-
- // 9.0 macros folder:
- path = base + "/VSMacros80";
- // *NOT* a typo; right now in Visual Studio 2008 beta the macros
- // folder is VSMacros80... They may change it to 90 before final
- // release of 2008 or they may not... we'll have to keep our eyes
- // on it
- }
-
- // path is (correctly) still empty if we did not read the base value from
- // the Registry value
- return path;
-}
-
-//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase()
-{
- return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
-}
-
-//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
{
this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 92202ba..f0dd7d7 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -84,18 +84,6 @@ public:
bool TargetsWindowsStore() const
{ return this->SystemIsWindowsStore; }
- /**
- * Where does this version of Visual Studio look for macros for the
- * current user? Returns the empty string if this version of Visual
- * Studio does not implement support for VB macros.
- */
- virtual std::string GetUserMacrosDirectory();
-
- /**
- * What is the reg key path to "vsmacros" for this version of Visual
- * Studio?
- */
- virtual std::string GetUserMacrosRegKeyBase();
virtual const char* GetCMakeCFGIntDir() const
{ return "$(Configuration)";}
bool Find64BitTools(cmMakefile* mf);
@@ -156,5 +144,8 @@ private:
virtual std::string FindMSBuildCommand();
virtual std::string FindDevEnvCommand();
virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
+
+ // We do not use the reload macros for VS >= 10.
+ virtual std::string GetUserMacrosDirectory() { return ""; }
};
#endif
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index ed828b6..5d3ae16 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -78,8 +78,11 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.Name = vs11generatorName;
- entry.Brief = "Generates Visual Studio 11 (VS 2012) project files.";
+ entry.Name = std::string(vs11generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2012 project files. "
+ "Optional [arch] can be \"Win64\" or \"ARM\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index c79dc97..6d434eb 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -31,8 +31,6 @@ public:
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
- /** TODO: VS 11 user macro support. */
- virtual std::string GetUserMacrosDirectory() { return ""; }
protected:
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index c2e6f47..e70e082 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -66,8 +66,11 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.Name = vs12generatorName;
- entry.Brief = "Generates Visual Studio 12 (VS 2013) project files.";
+ entry.Name = std::string(vs12generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2013 project files. "
+ "Optional [arch] can be \"Win64\" or \"ARM\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index a81516f..5e5b5f7 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -31,9 +31,6 @@ public:
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
- /** TODO: VS 12 user macro support. */
- virtual std::string GetUserMacrosDirectory() { return ""; }
-
//in Visual Studio 2013 they detached the MSBuild tools version
//from the .Net Framework version and instead made it have it's own
//version number
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index b551c65..7b1dd24 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -66,8 +66,11 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
- entry.Name = vs14generatorName;
- entry.Brief = "Generates Visual Studio 14 (VS 2015) project files.";
+ entry.Name = std::string(vs14generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2015 project files. "
+ "Optional [arch] can be \"Win64\" or \"ARM\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 3fd60a0..ad1a460 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -31,9 +31,6 @@ public:
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator();
- /** TODO: VS 14 user macro support. */
- virtual std::string GetUserMacrosDirectory() { return ""; }
-
virtual const char* GetToolsVersion() { return "14.0"; }
protected:
virtual const char* GetIDEVersion() { return "14.0"; }
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 62a308e..e2b2bbd4 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -185,6 +185,22 @@ void cmGlobalVisualStudio6Generator::Generate()
// Now write out the DSW
this->OutputDSWFile();
+
+ if (!this->CMakeInstance->GetIsInTryCompile())
+ {
+ const char* cmakeWarnVS6 =
+ this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS6");
+ if (!cmakeWarnVS6 || !cmSystemTools::IsOff(cmakeWarnVS6))
+ {
+ this->CMakeInstance->IssueMessage(
+ cmake::WARNING,
+ "The \"Visual Studio 6\" generator is deprecated "
+ "and will be removed in a future version of CMake."
+ "\n"
+ "Add CMAKE_WARN_VS6=OFF to the cache to disable this warning."
+ );
+ }
+ }
}
// Write a DSW file to the stream
@@ -411,7 +427,7 @@ void cmGlobalVisualStudio6Generator
::GetDocumentation(cmDocumentationEntry& entry)
{
entry.Name = cmGlobalVisualStudio6Generator::GetActualName();
- entry.Brief = "Generates Visual Studio 6 project files.";
+ entry.Brief = "Deprecated. Generates Visual Studio 6 project files.";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 0e0e63a..0d7dfd7 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -89,7 +89,7 @@ void cmGlobalVisualStudio7Generator
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
- cmCacheManager::STRING);
+ cmState::STRING);
}
// Create list of configurations requested by user's cache, if any.
@@ -109,7 +109,7 @@ void cmGlobalVisualStudio7Generator
mf->AddCacheDefinition
("CMAKE_MSVCIDE_RUN_PATH", extraPath,
"Saved environment variable CMAKE_MSVCIDE_RUN_PATH",
- cmCacheManager::STATIC);
+ cmState::STATIC);
}
}
@@ -335,7 +335,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
- cmCacheManager::STRING);
+ cmState::STRING);
}
void cmGlobalVisualStudio7Generator::Generate()
@@ -351,6 +351,23 @@ void cmGlobalVisualStudio7Generator::Generate()
{
this->CallVisualStudioMacro(MacroReload);
}
+
+ if (!this->CMakeInstance->GetIsInTryCompile() &&
+ this->GetName() == "Visual Studio 7")
+ {
+ const char* cmakeWarnVS70 =
+ this->CMakeInstance->GetState()->GetCacheEntryValue("CMAKE_WARN_VS70");
+ if (!cmakeWarnVS70 || !cmSystemTools::IsOff(cmakeWarnVS70))
+ {
+ this->CMakeInstance->IssueMessage(
+ cmake::WARNING,
+ "The \"Visual Studio 7\" generator is deprecated "
+ "and will be removed in a future version of CMake."
+ "\n"
+ "Add CMAKE_WARN_VS70=OFF to the cache to disable this warning."
+ );
+ }
+ }
}
void cmGlobalVisualStudio7Generator
@@ -970,7 +987,7 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
ret = cmSystemTools::UpperCase(ret);
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
ret.c_str(), "Stored GUID",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
@@ -983,7 +1000,7 @@ void cmGlobalVisualStudio7Generator
::GetDocumentation(cmDocumentationEntry& entry)
{
entry.Name = cmGlobalVisualStudio7Generator::GetActualName();
- entry.Brief = "Generates Visual Studio .NET 2002 project files.";
+ entry.Brief = "Deprecated. Generates Visual Studio .NET 2002 project files.";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index e6ce45d..726db0f 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -66,8 +66,11 @@ public:
}
virtual void GetDocumentation(cmDocumentationEntry& entry) const {
- entry.Name = vs8generatorName;
- entry.Brief = "Generates Visual Studio 8 2005 project files.";
+ entry.Name = std::string(vs8generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2005 project files. "
+ "Optional [arch] can be \"Win64\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const {
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 1d73b5c..1bc627f 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -70,8 +70,11 @@ public:
}
virtual void GetDocumentation(cmDocumentationEntry& entry) const {
- entry.Name = vs9generatorName;
- entry.Brief = "Generates Visual Studio 9 2008 project files.";
+ entry.Name = std::string(vs9generatorName) + " [arch]";
+ entry.Brief =
+ "Generates Visual Studio 2008 project files. "
+ "Optional [arch] can be \"Win64\" or \"IA64\"."
+ ;
}
virtual void GetGenerators(std::vector<std::string>& names) const {
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 356f4d4..cb54132 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -51,8 +51,8 @@ public:
* Call the ReloadProjects macro if necessary based on
* GetFilesReplacedDuringGenerate results.
*/
- virtual void CallVisualStudioMacro(MacroName m,
- const char* vsSolutionFile = 0);
+ void CallVisualStudioMacro(MacroName m,
+ const char* vsSolutionFile = 0);
// return true if target is fortran only
bool TargetIsFortranOnly(cmTarget const& t);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5e584a4..8c37338 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -285,7 +285,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
- cmCacheManager::STRING);
+ cmState::STRING);
}
}
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
@@ -592,6 +592,20 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
}
//----------------------------------------------------------------------------
+
+static bool objectIdLessThan(cmXCodeObject* l, cmXCodeObject* r)
+{
+ return l->GetId() < r->GetId();
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator::SortXCodeObjects()
+{
+ std::sort(this->XCodeObjects.begin(), this->XCodeObjects.end(),
+ objectIdLessThan);
+}
+
+//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::ClearXCodeObjects()
{
this->TargetDoneSet.clear();
@@ -2754,7 +2768,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
}
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
- id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL);
+ id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL);
return id;
}
@@ -3372,7 +3386,7 @@ bool cmGlobalXCodeGenerator
}
configlist->AddAttribute("buildConfigurations", buildConfigurations);
- std::string comment = "Build configuration list for PBXProject ";
+ std::string comment = "Build configuration list for PBXProject";
comment += " \"";
comment += this->CurrentProject;
comment += "\"";
@@ -3703,7 +3717,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
// Since this call may have created new cache entries, save the cache:
//
- root->GetMakefile()->GetCacheManager()->SaveCache(
+ root->GetMakefile()->GetCMakeInstance()->SaveCache(
root->GetMakefile()->GetHomeOutputDirectory());
}
@@ -3713,6 +3727,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmLocalGenerator* ,
std::vector<cmLocalGenerator*>& )
{
+ SortXCodeObjects();
+
fout << "// !$*UTF8*$!\n";
fout << "{\n";
cmXCodeObject::Indent(1, fout);
@@ -3740,7 +3756,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::PrintList(this->XCodeObjects, fout);
}
cmXCodeObject::Indent(1, fout);
- fout << "rootObject = " << this->RootObject->GetId() << ";\n";
+ fout << "rootObject = " << this->RootObject->GetId()
+ << " /* Project object */;\n";
fout << "}\n";
}
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index b272f6a..1a69fce 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -150,6 +150,7 @@ private:
cmXCodeObject* buildSettings,
const std::string& buildType);
std::string ExtractFlag(const char* flag, std::string& flags);
+ void SortXCodeObjects();
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();
bool CreateXCodeObjects(cmLocalGenerator* root,
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index d40d8fe..1e7258a 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -73,7 +73,7 @@ bool cmIncludeExternalMSProjectCommand
std::string guidVariable = utility_name + "_GUID_CMAKE";
this->Makefile->GetCMakeInstance()->AddCacheEntry(
guidVariable.c_str(), customGuid.c_str(),
- "Stored GUID", cmCacheManager::INTERNAL);
+ "Stored GUID", cmState::INTERNAL);
}
// Create a target instance for this utility.
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 93aec32..6ade535 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -81,8 +81,8 @@ bool cmLoadCacheCommand
{
break;
}
- this->Makefile->GetCacheManager()->LoadCache(args[i], false,
- excludes, includes);
+ this->Makefile->GetCMakeInstance()->LoadCache(args[i], false,
+ excludes, includes);
}
@@ -172,8 +172,8 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// Check one line of the cache file.
std::string var;
std::string value;
- cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
- if(cmCacheManager::ParseEntry(line, var, value, type))
+ cmState::CacheEntryType type = cmState::UNINITIALIZED;
+ if(cmake::ParseCacheEntry(line, var, value, type))
{
// Found a real entry. See if this one was requested.
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index cdfd00c..403f7fc 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -273,7 +273,7 @@ bool cmLoadCommandCommand
// create a function blocker and set it up
cmLoadedCommand *f = new cmLoadedCommand();
(*initFunction)(&f->info);
- this->Makefile->AddCommand(f);
+ this->Makefile->GetState()->AddCommand(f);
return true;
}
this->SetError("Attempt to load command failed. "
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 81854f3..6bce088 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -252,7 +252,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
this->Makefile->SetLocalGenerator(this);
// setup the home directories
- this->Makefile->GetProperties().SetCMakeInstance(gg->GetCMakeInstance());
this->Makefile->SetHomeDirectory(
gg->GetCMakeInstance()->GetHomeDirectory());
this->Makefile->SetHomeOutputDirectory(
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 640c1b3..645d32a 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"
#include "cmake.h"
+#include "cmState.h"
#include <assert.h>
@@ -234,8 +235,8 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);
- const char* jobpools = this->GetCMakeInstance()
- ->GetProperty("JOB_POOLS", cmProperty::GLOBAL);
+ const char* jobpools = this->GetCMakeInstance()->GetState()
+ ->GetGlobalProperty("JOB_POOLS");
if (jobpools)
{
cmGlobalNinjaGenerator::WriteComment(os,
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index aa70ab9..2b67562 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -118,7 +118,7 @@ void cmLocalVisualStudio10Generator
AddCacheEntry(guidStoreName.c_str(),
parser.GUID.c_str(),
"Stored GUID",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index c4abeb2..884212b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -16,7 +16,6 @@
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmSourceFile.h"
-#include "cmCacheManager.h"
#include "cmGeneratorTarget.h"
#include "cmCustomCommandGenerator.h"
#include "cmake.h"
@@ -2331,7 +2330,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
AddCacheEntry(guidStoreName.c_str(),
parser.GUID.c_str(),
"Stored GUID",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index b7cbae6..7ac4432 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -232,9 +232,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
f->Functions = this->Functions;
mf.RecordPolicies(f->Policies);
std::string newName = "_" + this->Args[0];
- mf.GetCMakeInstance()->RenameCommand(this->Args[0],
- newName);
- mf.AddCommand(f);
+ mf.GetState()->RenameCommand(this->Args[0], newName);
+ mf.GetState()->AddCommand(f);
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(this, lff);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 215ee16..205508b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -18,7 +18,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmCommands.h"
-#include "cmCacheManager.h"
+#include "cmState.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
#include "cmCommandArgumentParserHelper.h"
@@ -174,16 +174,6 @@ void cmMakefile::Initialize()
this->CheckCMP0000 = false;
}
-unsigned int cmMakefile::GetCacheMajorVersion() const
-{
- return this->GetCacheManager()->GetCacheMajorVersion();
-}
-
-unsigned int cmMakefile::GetCacheMinorVersion() const
-{
- return this->GetCacheManager()->GetCacheMinorVersion();
-}
-
cmMakefile::~cmMakefile()
{
cmDeleteAll(this->InstallGenerators);
@@ -254,12 +244,6 @@ void cmMakefile::Print() const
#endif
}
-bool cmMakefile::CommandExists(const char* name) const
-{
- return this->GetCMakeInstance()->CommandExists(name);
-}
-
-
//----------------------------------------------------------------------------
void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const
@@ -350,7 +334,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
static_cast<void>(stack_manager);
// Lookup the command prototype.
- if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name))
+ if(cmCommand* proto = this->GetState()->GetCommand(name))
{
// Clone the prototype.
cmsys::auto_ptr<cmCommand> pcmd(proto->Clone());
@@ -728,11 +712,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const
}
}
-void cmMakefile::AddCommand(cmCommand* wg)
-{
- this->GetCMakeInstance()->AddCommand(wg);
-}
-
// Set the make file
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
{
@@ -751,6 +730,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
+ this->Properties.SetCMakeInstance(this->GetCMakeInstance());
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
}
@@ -1667,7 +1647,6 @@ void cmMakefile::InitializeFromParent()
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
{
- // copy our variables from the child makefile
lg2->GetMakefile()->InitializeFromParent();
lg2->GetMakefile()->MakeStartDirectoriesCurrent();
if (this->GetCMakeInstance()->GetDebugOutput())
@@ -1686,33 +1665,6 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
}
}
-void cmMakefile::AddSubDirectory(const std::string& sub,
- bool excludeFromAll)
-{
- // the source path must be made full if it isn't already
- std::string srcPath = sub;
- if (!cmSystemTools::FileIsFullPath(srcPath.c_str()))
- {
- srcPath = this->GetCurrentDirectory();
- srcPath += "/";
- srcPath += sub;
- }
-
- // binary path must be made full if it isn't already
- std::string binPath = sub;
- if (!cmSystemTools::FileIsFullPath(binPath.c_str()))
- {
- binPath = this->GetCurrentOutputDirectory();
- binPath += "/";
- binPath += sub;
- }
-
-
- this->AddSubDirectory(srcPath, binPath,
- excludeFromAll, false);
-}
-
-
void cmMakefile::AddSubDirectory(const std::string& srcPath,
const std::string& binPath,
bool excludeFromAll,
@@ -1815,24 +1767,25 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type,
+ cmState::CacheEntryType type,
bool force)
{
bool haveVal = value ? true : false;
std::string val = haveVal ? value : "";
- cmCacheManager::CacheIterator it =
- this->GetCacheManager()->GetCacheIterator(name.c_str());
- if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
- it.Initialized())
+ const char* existingValue =
+ this->GetState()->GetInitializedCacheValue(name);
+ if(existingValue
+ && (this->GetState()->GetCacheEntryType(name)
+ == cmState::UNINITIALIZED))
{
// if this is not a force, then use the value from the cache
// if it is a force, then use the value being passed in
if(!force)
{
- val = it.GetValue();
+ val = existingValue;
haveVal = true;
}
- if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
+ if ( type == cmState::PATH || type == cmState::FILEPATH )
{
std::vector<std::string>::size_type cc;
std::vector<std::string> files;
@@ -1851,14 +1804,14 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
nvalue += files[cc];
}
- this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
- val = it.GetValue();
+ this->GetState()->AddCacheEntry(name, nvalue.c_str(), doc, type);
+ val = this->GetState()->GetInitializedCacheValue(name);
haveVal = true;
}
}
- this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc,
- type);
+ this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
+ doc, type);
// if there was a definition then remove it
this->Internal->VarStack.top().Set(name, 0);
}
@@ -1985,7 +1938,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
void cmMakefile::RemoveCacheDefinition(const std::string& name)
{
- this->GetCacheManager()->RemoveCacheEntry(name);
+ this->GetState()->RemoveCacheEntry(name);
}
void cmMakefile::SetProjectName(const char* p)
@@ -2442,7 +2395,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
this->Internal->VarUsageStack.top().insert(name);
if(!def)
{
- def = this->GetCacheManager()->GetCacheValue(name);
+ def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
if(cmVariableWatch* vv = this->GetVariableWatch())
@@ -2467,7 +2420,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
const char* def = this->Internal->VarStack.top().Get(name);
if(!def)
{
- def = this->GetCacheManager()->GetCacheValue(name);
+ def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
@@ -2501,20 +2454,18 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
std::vector<std::string> cmMakefile
::GetDefinitions(int cacheonly /* = 0 */) const
{
- std::set<std::string> definitions;
+ std::vector<std::string> res;
if ( !cacheonly )
{
- definitions = this->Internal->VarStack.top().ClosureKeys();
- }
- cmCacheManager::CacheIterator cit =
- this->GetCacheManager()->GetCacheIterator();
- for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
- {
- definitions.insert(cit.GetName());
+ std::set<std::string> definitions =
+ this->Internal->VarStack.top().ClosureKeys();
+ res.insert(res.end(), definitions.begin(), definitions.end());
}
+ std::vector<std::string> cacheKeys =
+ this->GetState()->GetCacheEntryKeys();
+ res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
- std::vector<std::string> res;
- res.insert(res.end(), definitions.begin(), definitions.end());
+ std::sort(res.begin(), res.end());
return res;
}
@@ -2812,6 +2763,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
openstack.push(t_lookup());
cmake::MessageType mtype = cmake::LOG;
+ cmState* state = this->GetCMakeInstance()->GetState();
+
do
{
char inc = *in;
@@ -2845,7 +2798,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
value = cmSystemTools::GetEnv(lookup.c_str());
break;
case CACHE:
- value = this->GetCacheManager()->GetCacheValue(lookup);
+ value = state->GetCacheEntryValue(lookup);
break;
}
// Get the string we're meant to append to.
@@ -3471,6 +3424,11 @@ cmMakefile::LexicalPushPop::~LexicalPushPop()
this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
}
+const char* cmMakefile::GetHomeDirectory() const
+{
+ return this->cmHomeDirectory.c_str();
+}
+
void cmMakefile::SetHomeDirectory(const std::string& dir)
{
this->cmHomeDirectory = dir;
@@ -3482,6 +3440,11 @@ void cmMakefile::SetHomeDirectory(const std::string& dir)
}
}
+const char* cmMakefile::GetHomeOutputDirectory() const
+{
+ return this->HomeOutputDirectory.c_str();
+}
+
void cmMakefile::SetHomeOutputDirectory(const std::string& lib)
{
this->HomeOutputDirectory = lib;
@@ -3625,7 +3588,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// Add this before the user-provided CMake arguments in case
// one of the arguments is -DCMAKE_BUILD_TYPE=...
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config,
- "Build configuration", cmCacheManager::STRING);
+ "Build configuration", cmState::STRING);
}
}
// if cmake args were provided then pass them in
@@ -3664,12 +3627,12 @@ int cmMakefile::TryCompile(const std::string& srcdir,
if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
{
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
- "TRUE", "", cmCacheManager::INTERNAL);
+ "TRUE", "", cmState::INTERNAL);
}
else
{
cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS",
- "FALSE", "", cmCacheManager::INTERNAL);
+ "FALSE", "", cmState::INTERNAL);
}
if (cm.Configure() != 0)
{
@@ -3743,9 +3706,9 @@ void cmMakefile::GetListOfMacros(std::string& macros) const
macros = cmJoin(this->MacrosList, ";");
}
-cmCacheManager *cmMakefile::GetCacheManager() const
+cmState *cmMakefile::GetState() const
{
- return this->GetCMakeInstance()->GetCacheManager();
+ return this->GetCMakeInstance()->GetState();
}
void cmMakefile::DisplayStatus(const char* message, float s) const
@@ -4276,7 +4239,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
return this->LocalGenerator->GetParent()->GetMakefile()->
GetProperty(prop, scope);
}
- return this->GetCMakeInstance()->GetProperty(prop,scope);
+ return this->GetState()->GetGlobalProperty(prop);
}
return retVal;
@@ -4502,21 +4465,6 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef)
}
}
-
-// define properties
-void cmMakefile::DefineProperties(cmake *cm)
-{
- cm->DefineProperty
- ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
- "", "", true);
- cm->DefineProperty
- ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY,
- "", "", true);
- cm->DefineProperty
- ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY,
- "", "", true);
-}
-
//----------------------------------------------------------------------------
cmTarget*
cmMakefile::AddImportedTarget(const std::string& name,
@@ -4637,7 +4585,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
this->LocalGenerator->GetGlobalGenerator()->GetCMakeInstance();
if(isCustom && existing->GetType() == cmTarget::UTILITY &&
this != existing->GetMakefile() &&
- cm->GetPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS"))
+ cm->GetState()
+ ->GetGlobalPropertyAsBool("ALLOW_DUPLICATE_CUSTOM_TARGETS"))
{
return true;
}
@@ -4912,8 +4861,8 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
if(id == cmPolicies::CMP0001 &&
(status == cmPolicies::WARN || status == cmPolicies::OLD))
{
- if(!(this->GetCacheManager()
- ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
+ if(!(this->GetState()
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
{
// Set it to 2.4 because that is the last version where the
// variable had meaning.
@@ -4922,7 +4871,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
"For backwards compatibility, what version of CMake "
"commands and "
"syntax should this version of CMake try to support.",
- cmCacheManager::STRING);
+ cmState::STRING);
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 920b6b7..299d550 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -12,7 +12,6 @@
#ifndef cmMakefile_h
#define cmMakefile_h
-#include "cmCacheManager.h"
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
@@ -23,6 +22,7 @@
#include "cmGeneratorTarget.h"
#include "cmExpandedCommandArgument.h"
#include "cmake.h"
+#include "cmState.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h"
@@ -62,14 +62,6 @@ class cmMakefile
class Internals;
cmsys::auto_ptr<Internals> Internal;
public:
- /**
- * Return the major and minor version of the cmake that
- * was used to write the currently loaded cache, note
- * this method will not work before the cache is loaded.
- */
- unsigned int GetCacheMajorVersion() const;
- unsigned int GetCacheMinorVersion() const;
-
/* Check for unused variables in this scope */
void CheckForUnusedVariables() const;
/* Mark a variable as used */
@@ -289,7 +281,6 @@ public:
/**
* Add a subdirectory to the build.
*/
- void AddSubDirectory(const std::string&, bool excludeFromAll=false);
void AddSubDirectory(const std::string& fullSrcDir,
const std::string& fullBinDir,
bool excludeFromAll,
@@ -314,7 +305,7 @@ public:
///! Add a definition to this makefile and the global cmake cache.
void AddCacheDefinition(const std::string& name, const char* value,
const char* doc,
- cmCacheManager::CacheEntryType type,
+ cmState::CacheEntryType type,
bool force = false);
/**
@@ -446,15 +437,9 @@ public:
* and going up until it reaches the HomeDirectory.
*/
void SetHomeDirectory(const std::string& dir);
- const char* GetHomeDirectory() const
- {
- return this->cmHomeDirectory.c_str();
- }
+ const char* GetHomeDirectory() const;
void SetHomeOutputDirectory(const std::string& lib);
- const char* GetHomeOutputDirectory() const
- {
- return this->HomeOutputDirectory.c_str();
- }
+ const char* GetHomeOutputDirectory() const;
//@}
/**
@@ -761,19 +746,11 @@ public:
bool ExecuteCommand(const cmListFileFunction& lff,
cmExecutionStatus &status);
- /** Check if a command exists. */
- bool CommandExists(const char* name) const;
-
- /**
- * Add a command to this cmake instance
- */
- void AddCommand(cmCommand* );
-
///! Enable support for named language, if nil then all languages are
///enabled.
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
- cmCacheManager *GetCacheManager() const;
+ cmState *GetState() const;
/**
* Get the variable watch. This is used to determine when certain variables
@@ -866,9 +843,6 @@ public:
const std::vector<cmTestGenerator*>& GetTestGenerators() const
{ return this->TestGenerators; }
- // Define the properties
- static void DefineProperties(cmake *cm);
-
// push and pop variable scopes
void PushScope();
void PopScope();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2cd2d3e..0076caf 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmake.h"
+#include "cmState.h"
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
#include "cmGeneratorExpression.h"
@@ -51,7 +52,8 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target);
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
this->NoRuleMessages = false;
- if(const char* ruleStatus = cm->GetProperty("RULE_MESSAGES"))
+ if(const char* ruleStatus = cm->GetState()
+ ->GetGlobalProperty("RULE_MESSAGES"))
{
this->NoRuleMessages = cmSystemTools::IsOff(ruleStatus);
}
@@ -778,7 +780,7 @@ cmMakefileTargetGenerator
// Write the rule.
this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
- depends, commands, false);
+ depends, commands);
bool do_preprocess_rules = lang_has_preprocessor &&
this->LocalGenerator->GetCreatePreprocessedSourceRules();
@@ -1000,18 +1002,30 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
}
//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteMakeRule(
+bool cmMakefileTargetGenerator::WriteMakeRule(
std::ostream& os,
const char* comment,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
- bool symbolic,
bool in_help)
{
+ bool symbolic = false;
if (outputs.size() == 0)
{
- return;
+ return symbolic;
+ }
+
+ // Check whether we need to bother checking for a symbolic output.
+ bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
+
+ // Check whether the first output is marked as symbolic.
+ if(need_symbolic)
+ {
+ if(cmSourceFile* sf = this->Makefile->GetSource(outputs[0]))
+ {
+ symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+ }
}
// We always attach the actual commands to the first output.
@@ -1021,7 +1035,7 @@ void cmMakefileTargetGenerator::WriteMakeRule(
// For single outputs, we are done.
if (outputs.size() == 1)
{
- return;
+ return symbolic;
}
// For multiple outputs, make the extra ones depend on the first one.
@@ -1034,14 +1048,25 @@ void cmMakefileTargetGenerator::WriteMakeRule(
std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::SHELL);
std::vector<std::string> output_commands;
- if (!symbolic)
+
+ bool o_symbolic = false;
+ if(need_symbolic)
+ {
+ if(cmSourceFile* sf = this->Makefile->GetSource(*o))
+ {
+ o_symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+ }
+ }
+ symbolic = symbolic && o_symbolic;
+
+ if (!o_symbolic)
{
output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out);
}
this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends,
- output_commands, symbolic, in_help);
+ output_commands, o_symbolic, in_help);
- if (!symbolic)
+ if (!o_symbolic)
{
// At build time, remove the first output if this one does not exist
// so that "make" will rerun the real commands that create this one.
@@ -1049,6 +1074,7 @@ void cmMakefileTargetGenerator::WriteMakeRule(
this->MultipleOutputPairs.insert(p);
}
}
+ return symbolic;
}
//----------------------------------------------------------------------------
@@ -1269,30 +1295,16 @@ void cmMakefileTargetGenerator
std::vector<std::string> depends;
this->LocalGenerator->AppendCustomDepend(depends, ccg);
- // Check whether we need to bother checking for a symbolic output.
- bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
-
// Write the rule.
const std::vector<std::string>& outputs = ccg.GetOutputs();
- std::vector<std::string>::const_iterator o = outputs.begin();
- {
- bool symbolic = false;
- if(need_symbolic)
- {
- if(cmSourceFile* sf = this->Makefile->GetSource(*o))
- {
- symbolic = sf->GetPropertyAsBool("SYMBOLIC");
- }
- }
- this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
- depends, commands, symbolic);
+ bool symbolic = this->WriteMakeRule(*this->BuildFileStream, 0,
+ outputs, depends, commands);
// If the rule has changed make sure the output is rebuilt.
if(!symbolic)
{
this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str());
}
- }
// Setup implicit dependency scanning.
for(cmCustomCommand::ImplicitDependsList::const_iterator
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 98017be..58044e8 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -224,12 +224,11 @@ protected:
typedef std::map<std::string, std::string> MultipleOutputPairsType;
MultipleOutputPairsType MultipleOutputPairs;
- void WriteMakeRule(std::ostream& os,
+ bool WriteMakeRule(std::ostream& os,
const char* comment,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
- bool symbolic,
bool in_help = false);
// Target name info.
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index f6a2c26..10d30f3 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -36,25 +36,20 @@ bool cmMarkAsAdvancedCommand
for(; i < args.size(); ++i)
{
std::string variable = args[i];
- cmCacheManager* manager = this->Makefile->GetCacheManager();
- cmCacheManager::CacheIterator it =
- manager->GetCacheIterator(variable.c_str());
- if ( it.IsAtEnd() )
+ cmState* state = this->Makefile->GetState();
+ if (!state->GetCacheEntryValue(variable))
{
- this->Makefile->GetCacheManager()
- ->AddCacheEntry(variable, 0, 0,
- cmCacheManager::UNINITIALIZED);
+ state->AddCacheEntry(variable, 0, 0, cmState::UNINITIALIZED);
overwrite = true;
}
- it.Find(variable);
- if ( it.IsAtEnd() )
+ if (!state->GetCacheEntryValue(variable))
{
cmSystemTools::Error("This should never happen...");
return false;
}
- if ( !it.PropertyExists("ADVANCED") || overwrite )
+ if (!state->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
{
- it.SetProperty("ADVANCED", value);
+ state->SetCacheEntryProperty(variable, "ADVANCED", value);
}
}
return true;
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 60728ea..92be5f1 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -42,16 +42,16 @@ bool cmOptionCommand
std::string initialValue = "Off";
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
- cmCacheManager::CacheIterator it =
- this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str());
- if(!it.IsAtEnd())
+ cmState* state = this->Makefile->GetState();
+ const char* existingValue = state->GetCacheEntryValue(args[0]);
+ if(existingValue)
{
- if ( it.GetType() != cmCacheManager::UNINITIALIZED )
+ if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED)
{
- it.SetProperty("HELPSTRING", args[1].c_str());
+ state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
return true;
}
- initialValue = it.GetValue();
+ initialValue = existingValue;
}
if(args.size() == 3)
{
@@ -59,6 +59,6 @@ bool cmOptionCommand
}
bool init = cmSystemTools::IsOn(initialValue.c_str());
this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF",
- args[1].c_str(), cmCacheManager::BOOL);
+ args[1].c_str(), cmState::BOOL);
return true;
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 0a61bca..e7678cb 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -390,6 +390,11 @@ cmPolicies::cmPolicies()
CMP0059, "CMP0059",
"Do no treat DEFINITIONS as a built-in directory property.",
3,3,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0060, "CMP0060",
+ "Link libraries by full path even in implicit directories.",
+ 3,3,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ced9d8c..1d108c1 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -118,6 +118,7 @@ public:
CMP0058, ///< Ninja requires custom command byproducts to be explicit
CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory
/// property.
+ CMP0060, ///< Link libraries by full path even in implicit directories.
/** \brief Always the last entry.
*
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 61c0133..601dc54 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -30,11 +30,11 @@ bool cmProjectCommand
this->Makefile->AddCacheDefinition
(bindir,
this->Makefile->GetCurrentOutputDirectory(),
- "Value Computed by CMake", cmCacheManager::STATIC);
+ "Value Computed by CMake", cmState::STATIC);
this->Makefile->AddCacheDefinition
(srcdir,
this->Makefile->GetCurrentDirectory(),
- "Value Computed by CMake", cmCacheManager::STATIC);
+ "Value Computed by CMake", cmState::STATIC);
bindir = "PROJECT_BINARY_DIR";
srcdir = "PROJECT_SOURCE_DIR";
@@ -59,7 +59,7 @@ bool cmProjectCommand
this->Makefile->AddCacheDefinition
("CMAKE_PROJECT_NAME",
args[0].c_str(),
- "Value Computed by CMake", cmCacheManager::STATIC);
+ "Value Computed by CMake", cmState::STATIC);
}
bool haveVersion = false;
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index e335b3b..070f6f1 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -12,6 +12,7 @@
#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmake.h"
+#include "cmState.h"
cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
{
@@ -73,7 +74,8 @@ const char *cmPropertyMap
// should we chain up?
if (this->CMakeInstance)
{
- chain = this->CMakeInstance->IsPropertyChained(name,scope);
+ chain = this->CMakeInstance->GetState()->
+ IsPropertyChained(name,scope);
}
return 0;
}
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 4cb49c8..d49e997 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -16,6 +16,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+#include "cmState.h"
#include "cmAlgorithms.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -201,6 +202,13 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
std::string oline;
while(std::getline(ostr, oline))
{
+ // Strip CR characters rcc may have printed (possibly more than one!).
+ std::string::size_type cr = oline.find('\r');
+ if (cr != oline.npos)
+ {
+ oline = oline.substr(0, cr);
+ }
+
if (oline.empty())
{
// The output of rcc --list contains many empty lines.
@@ -472,12 +480,12 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
}
// Set target folder
- const char* autogenFolder = makefile->GetCMakeInstance()->GetProperty(
- "AUTOMOC_TARGETS_FOLDER");
+ const char* autogenFolder = makefile->GetState()
+ ->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
if (!autogenFolder)
{
- autogenFolder = makefile->GetCMakeInstance()->GetProperty(
- "AUTOGEN_TARGETS_FOLDER");
+ autogenFolder = makefile->GetState()
+ ->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
}
if (autogenFolder && *autogenFolder)
{
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 204d95b..bf9f42c 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -79,8 +79,8 @@ bool cmSetCommand
bool cache = false; // optional
bool force = false; // optional
bool parentScope = false;
- cmCacheManager::CacheEntryType type
- = cmCacheManager::STRING; // required if cache
+ cmState::CacheEntryType type
+ = cmState::STRING; // required if cache
const char* docstring = 0; // required if cache
unsigned int ignoreLastArgs = 0;
@@ -131,20 +131,21 @@ bool cmSetCommand
if(cache)
{
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
- type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
+ type = cmState::StringToCacheEntryType(args[cacheStart+1].c_str());
docstring = args[cacheStart+2].c_str();
}
// see if this is already in the cache
- cmCacheManager::CacheIterator it =
- this->Makefile->GetCacheManager()->GetCacheIterator(variable);
- if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED))
+ cmState* state = this->Makefile->GetState();
+ const char* existingValue = state->GetCacheEntryValue(variable);
+ if(existingValue &&
+ (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED))
{
// if the set is trying to CACHE the value but the value
// is already in the cache and the type is not internal
// then leave now without setting any definitions in the cache
// or the makefile
- if(cache && type != cmCacheManager::INTERNAL && !force)
+ if(cache && type != cmState::INTERNAL && !force)
{
return true;
}
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 1150bc7..bb94a72 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -14,7 +14,6 @@
#include "cmSetTestsPropertiesCommand.h"
#include "cmSetSourceFilesPropertiesCommand.h"
-#include "cmCacheManager.h"
//----------------------------------------------------------------------------
cmSetPropertyCommand::cmSetPropertyCommand()
@@ -426,7 +425,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
}
else if(this->PropertyName == "TYPE")
{
- if(!cmCacheManager::IsType(this->PropertyValue.c_str()))
+ if(!cmState::IsCacheEntryType(this->PropertyValue.c_str()))
{
std::ostringstream e;
e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\"";
@@ -452,11 +451,11 @@ bool cmSetPropertyCommand::HandleCacheMode()
// Get the source file.
cmMakefile* mf = this->GetMakefile();
cmake* cm = mf->GetCMakeInstance();
- cmCacheManager::CacheIterator it =
- cm->GetCacheManager()->GetCacheIterator(ni->c_str());
- if(!it.IsAtEnd())
+ const char* existingValue
+ = cm->GetState()->GetCacheEntryValue(*ni);
+ if(existingValue)
{
- if(!this->HandleCacheEntry(it))
+ if(!this->HandleCacheEntry(*ni))
{
return false;
}
@@ -474,22 +473,24 @@ bool cmSetPropertyCommand::HandleCacheMode()
}
//----------------------------------------------------------------------------
-bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
+bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
{
// Set or append the property.
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
+ cmState* state = this->Makefile->GetState();
if (this->Remove)
{
- value = 0;
+ state->RemoveCacheEntryProperty(cacheKey, name);
}
if(this->AppendMode)
{
- it.AppendProperty(name, value, this->AppendAsString);
+ state->AppendCacheEntryProperty(cacheKey, name, value,
+ this->AppendAsString);
}
else
{
- it.SetProperty(name, value);
+ state->SetCacheEntryProperty(cacheKey, name, value);
}
return true;
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index b06cb68..3285e60 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -61,7 +61,7 @@ private:
bool HandleTestMode();
bool HandleTest(cmTest* test);
bool HandleCacheMode();
- bool HandleCacheEntry(cmCacheManager::CacheIterator&);
+ bool HandleCacheEntry(std::string const&);
bool HandleInstallMode();
bool HandleInstall(cmInstalledFile* file);
};
diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx
index 927888b..20a61a0 100644
--- a/Source/cmSiteNameCommand.cxx
+++ b/Source/cmSiteNameCommand.cxx
@@ -88,7 +88,7 @@ bool cmSiteNameCommand
AddCacheDefinition(args[0],
siteName.c_str(),
"Name of the computer/site where compile is being run",
- cmCacheManager::STRING);
+ cmState::STRING);
return true;
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
new file mode 100644
index 0000000..96f8a51
--- /dev/null
+++ b/Source/cmState.cxx
@@ -0,0 +1,446 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 Stephen Kelly <steveire@gmail.com>
+
+ 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 "cmState.h"
+
+#include "cmake.h"
+#include "cmCacheManager.h"
+#include "cmCommand.h"
+#include "cmAlgorithms.h"
+
+#include <assert.h>
+
+cmState::cmState(cmake* cm)
+ : CMakeInstance(cm),
+ IsInTryCompile(false)
+{
+ this->Initialize();
+}
+
+cmState::~cmState()
+{
+ cmDeleteAll(this->Commands);
+}
+
+const char* cmCacheEntryTypes[] =
+{ "BOOL",
+ "PATH",
+ "FILEPATH",
+ "STRING",
+ "INTERNAL",
+ "STATIC",
+ "UNINITIALIZED",
+ 0
+};
+
+const char*
+cmState::CacheEntryTypeToString(cmState::CacheEntryType type)
+{
+ if ( type > 6 )
+ {
+ return cmCacheEntryTypes[6];
+ }
+ return cmCacheEntryTypes[type];
+}
+
+cmState::CacheEntryType
+cmState::StringToCacheEntryType(const char* s)
+{
+ int i = 0;
+ while(cmCacheEntryTypes[i])
+ {
+ if(strcmp(s, cmCacheEntryTypes[i]) == 0)
+ {
+ return static_cast<cmState::CacheEntryType>(i);
+ }
+ ++i;
+ }
+ return STRING;
+}
+
+bool cmState::IsCacheEntryType(std::string const& key)
+{
+ for(int i=0; cmCacheEntryTypes[i]; ++i)
+ {
+ if(strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+std::vector<std::string> cmState::GetCacheEntryKeys() const
+{
+ std::vector<std::string> definitions;
+ definitions.reserve(this->CMakeInstance->GetCacheManager()->GetSize());
+ cmCacheManager::CacheIterator cit =
+ this->CMakeInstance->GetCacheManager()->GetCacheIterator();
+ for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
+ {
+ definitions.push_back(cit.GetName());
+ }
+ return definitions;
+}
+
+const char* cmState::GetCacheEntryValue(std::string const& key) const
+{
+ cmCacheManager::CacheEntry* e = this->CMakeInstance->GetCacheManager()
+ ->GetCacheEntry(key);
+ if (!e)
+ {
+ return 0;
+ }
+ return e->Value.c_str();
+}
+
+const char*
+cmState::GetInitializedCacheValue(std::string const& key) const
+{
+ return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key);
+}
+
+cmState::CacheEntryType
+cmState::GetCacheEntryType(std::string const& key) const
+{
+ cmCacheManager::CacheIterator it =
+ this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
+ return it.GetType();
+}
+
+void cmState::SetCacheEntryValue(std::string const& key,
+ std::string const& value)
+{
+ this->CMakeInstance->GetCacheManager()->SetCacheEntryValue(key, value);
+}
+
+void cmState::SetCacheEntryProperty(std::string const& key,
+ std::string const& propertyName,
+ std::string const& value)
+{
+ cmCacheManager::CacheIterator it =
+ this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
+ it.SetProperty(propertyName, value.c_str());
+}
+
+void cmState::SetCacheEntryBoolProperty(std::string const& key,
+ std::string const& propertyName,
+ bool value)
+{
+ cmCacheManager::CacheIterator it =
+ this->CMakeInstance->GetCacheManager()->GetCacheIterator(key.c_str());
+ it.SetProperty(propertyName, value);
+}
+
+const char* cmState::GetCacheEntryProperty(std::string const& key,
+ std::string const& propertyName)
+{
+ cmCacheManager::CacheIterator it = this->CMakeInstance->GetCacheManager()
+ ->GetCacheIterator(key.c_str());
+ if (!it.PropertyExists(propertyName))
+ {
+ return 0;
+ }
+ return it.GetProperty(propertyName);
+}
+
+bool cmState::GetCacheEntryPropertyAsBool(std::string const& key,
+ std::string const& propertyName)
+{
+ return this->CMakeInstance->GetCacheManager()
+ ->GetCacheIterator(key.c_str()).GetPropertyAsBool(propertyName);
+}
+
+void cmState::AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString,
+ cmState::CacheEntryType type)
+{
+ this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value,
+ helpString, type);
+}
+
+void cmState::RemoveCacheEntry(std::string const& key)
+{
+ this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(key);
+}
+
+void cmState::AppendCacheEntryProperty(const std::string& key,
+ const std::string& property,
+ const std::string& value,
+ bool asString)
+{
+ this->CMakeInstance->GetCacheManager()
+ ->GetCacheIterator(key.c_str()).AppendProperty(property,
+ value.c_str(),
+ asString);
+}
+
+void cmState::RemoveCacheEntryProperty(std::string const& key,
+ std::string const& propertyName)
+{
+ this->CMakeInstance->GetCacheManager()
+ ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
+}
+
+void cmState::Initialize()
+{
+ this->GlobalProperties.clear();
+
+ this->PropertyDefinitions.clear();
+ this->DefineProperty
+ ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
+ "", "", true);
+ this->DefineProperty
+ ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY,
+ "", "", true);
+ this->DefineProperty
+ ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY,
+ "", "", true);
+
+ this->DefineProperty
+ ("RULE_LAUNCH_COMPILE", cmProperty::TARGET,
+ "", "", true);
+ this->DefineProperty
+ ("RULE_LAUNCH_LINK", cmProperty::TARGET,
+ "", "", true);
+ this->DefineProperty
+ ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET,
+ "", "", true);
+}
+
+void cmState::DefineProperty(const std::string& name,
+ cmProperty::ScopeType scope,
+ const char *ShortDescription,
+ const char *FullDescription,
+ bool chained)
+{
+ this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
+ FullDescription,
+ chained);
+}
+
+cmPropertyDefinition *cmState
+::GetPropertyDefinition(const std::string& name,
+ cmProperty::ScopeType scope)
+{
+ if (this->IsPropertyDefined(name,scope))
+ {
+ return &(this->PropertyDefinitions[scope][name]);
+ }
+ return 0;
+}
+
+bool cmState::IsPropertyDefined(const std::string& name,
+ cmProperty::ScopeType scope)
+{
+ return this->PropertyDefinitions[scope].IsPropertyDefined(name);
+}
+
+bool cmState::IsPropertyChained(const std::string& name,
+ cmProperty::ScopeType scope)
+{
+ return this->PropertyDefinitions[scope].IsPropertyChained(name);
+}
+
+void cmState::SetLanguageEnabled(std::string const& l)
+{
+ std::vector<std::string>::iterator it =
+ std::lower_bound(this->EnabledLanguages.begin(),
+ this->EnabledLanguages.end(), l);
+ if (it == this->EnabledLanguages.end() || *it != l)
+ {
+ this->EnabledLanguages.insert(it, l);
+ }
+}
+
+bool cmState::GetLanguageEnabled(std::string const& l) const
+{
+ return std::binary_search(this->EnabledLanguages.begin(),
+ this->EnabledLanguages.end(), l);
+}
+
+std::vector<std::string> cmState::GetEnabledLanguages() const
+{
+ return this->EnabledLanguages;
+}
+
+void cmState::ClearEnabledLanguages()
+{
+ this->EnabledLanguages.clear();
+}
+
+bool cmState::GetIsInTryCompile() const
+{
+ return this->IsInTryCompile;
+}
+
+void cmState::SetIsInTryCompile(bool b)
+{
+ this->IsInTryCompile = b;
+}
+
+void cmState::RenameCommand(std::string const& oldName,
+ std::string const& newName)
+{
+ // if the command already exists, free the old one
+ std::string sOldName = cmSystemTools::LowerCase(oldName);
+ std::string sNewName = cmSystemTools::LowerCase(newName);
+ std::map<std::string, cmCommand*>::iterator pos =
+ this->Commands.find(sOldName);
+ if ( pos == this->Commands.end() )
+ {
+ return;
+ }
+ cmCommand* cmd = pos->second;
+
+ pos = this->Commands.find(sNewName);
+ if (pos != this->Commands.end())
+ {
+ delete pos->second;
+ this->Commands.erase(pos);
+ }
+ this->Commands.insert(std::make_pair(sNewName, cmd));
+ pos = this->Commands.find(sOldName);
+ this->Commands.erase(pos);
+}
+
+void cmState::AddCommand(cmCommand* command)
+{
+ std::string name = cmSystemTools::LowerCase(command->GetName());
+ // if the command already exists, free the old one
+ std::map<std::string, cmCommand*>::iterator pos = this->Commands.find(name);
+ if (pos != this->Commands.end())
+ {
+ delete pos->second;
+ this->Commands.erase(pos);
+ }
+ this->Commands.insert(std::make_pair(name, command));
+}
+
+void cmState::RemoveUnscriptableCommands()
+{
+ std::vector<std::string> unscriptableCommands;
+ for (std::map<std::string, cmCommand*>::iterator
+ pos = this->Commands.begin();
+ pos != this->Commands.end(); )
+ {
+ if (!pos->second->IsScriptable())
+ {
+ delete pos->second;
+ this->Commands.erase(pos++);
+ }
+ else
+ {
+ ++pos;
+ }
+ }
+}
+
+cmCommand* cmState::GetCommand(std::string const& name) const
+{
+ cmCommand* command = 0;
+ std::string sName = cmSystemTools::LowerCase(name);
+ std::map<std::string, cmCommand*>::const_iterator pos =
+ this->Commands.find(sName);
+ if (pos != this->Commands.end())
+ {
+ command = (*pos).second;
+ }
+ return command;
+}
+
+std::vector<std::string> cmState::GetCommandNames() const
+{
+ std::vector<std::string> commandNames;
+ commandNames.reserve(this->Commands.size());
+ std::map<std::string, cmCommand*>::const_iterator cmds
+ = this->Commands.begin();
+ for ( ; cmds != this->Commands.end(); ++ cmds )
+ {
+ commandNames.push_back(cmds->first);
+ }
+ return commandNames;
+}
+
+void cmState::RemoveUserDefinedCommands()
+{
+ for(std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
+ j != this->Commands.end(); )
+ {
+ if (j->second->IsA("cmMacroHelperCommand") ||
+ j->second->IsA("cmFunctionHelperCommand"))
+ {
+ delete j->second;
+ this->Commands.erase(j++);
+ }
+ else
+ {
+ ++j;
+ }
+ }
+}
+
+void cmState::SetGlobalProperty(const std::string& prop, const char* value)
+{
+ this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL);
+}
+
+void cmState::AppendGlobalProperty(const std::string& prop,
+ const char* value, bool asString)
+{
+ this->GlobalProperties.AppendProperty(prop, value,
+ cmProperty::GLOBAL, asString);
+}
+
+const char *cmState::GetGlobalProperty(const std::string& prop)
+{
+ // watch for special properties
+ std::string output = "";
+ if ( prop == "CACHE_VARIABLES" )
+ {
+ std::vector<std::string> cacheKeys = this->GetCacheEntryKeys();
+ this->SetGlobalProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
+ }
+ else if ( prop == "COMMANDS" )
+ {
+ std::vector<std::string> commands = this->GetCommandNames();
+ this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";").c_str());
+ }
+ else if ( prop == "IN_TRY_COMPILE" )
+ {
+ this->SetGlobalProperty("IN_TRY_COMPILE",
+ this->IsInTryCompile ? "1" : "0");
+ }
+ else if ( prop == "ENABLED_LANGUAGES" )
+ {
+ std::string langs;
+ langs = cmJoin(this->EnabledLanguages, ";");
+ this->SetGlobalProperty("ENABLED_LANGUAGES", langs.c_str());
+ }
+#define STRING_LIST_ELEMENT(F) ";" #F
+ if (prop == "CMAKE_C_KNOWN_FEATURES")
+ {
+ return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1;
+ }
+ if (prop == "CMAKE_CXX_KNOWN_FEATURES")
+ {
+ return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
+ }
+#undef STRING_LIST_ELEMENT
+ bool dummy = false;
+ return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL,
+ dummy);
+}
+
+bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
+{
+ return cmSystemTools::IsOn(this->GetGlobalProperty(prop));
+}
diff --git a/Source/cmState.h b/Source/cmState.h
new file mode 100644
index 0000000..34b2ccf
--- /dev/null
+++ b/Source/cmState.h
@@ -0,0 +1,107 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 Stephen Kelly <steveire@gmail.com>
+
+ 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 cmState_h
+#define cmState_h
+
+#include "cmStandardIncludes.h"
+#include "cmPropertyDefinitionMap.h"
+#include "cmPropertyMap.h"
+
+class cmake;
+class cmCommand;
+
+class cmState
+{
+public:
+ cmState(cmake* cm);
+ ~cmState();
+
+ enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
+ UNINITIALIZED };
+ static CacheEntryType StringToCacheEntryType(const char*);
+ static const char* CacheEntryTypeToString(CacheEntryType);
+ static bool IsCacheEntryType(std::string const& key);
+
+ std::vector<std::string> GetCacheEntryKeys() const;
+ const char* GetCacheEntryValue(std::string const& key) const;
+ const char* GetInitializedCacheValue(std::string const& key) const;
+ CacheEntryType GetCacheEntryType(std::string const& key) const;
+ void SetCacheEntryValue(std::string const& key, std::string const& value);
+ void SetCacheValue(std::string const& key, std::string const& value);
+
+ void AddCacheEntry(const std::string& key, const char* value,
+ const char* helpString, CacheEntryType type);
+ void RemoveCacheEntry(std::string const& key);
+
+ void SetCacheEntryProperty(std::string const& key,
+ std::string const& propertyName,
+ std::string const& value);
+ void SetCacheEntryBoolProperty(std::string const& key,
+ std::string const& propertyName,
+ bool value);
+ const char* GetCacheEntryProperty(std::string const& key,
+ std::string const& propertyName);
+ bool GetCacheEntryPropertyAsBool(std::string const& key,
+ std::string const& propertyName);
+ void AppendCacheEntryProperty(std::string const& key,
+ const std::string& property,
+ const std::string& value,
+ bool asString = false);
+ void RemoveCacheEntryProperty(std::string const& key,
+ std::string const& propertyName);
+
+ void Initialize();
+ // Define a property
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
+ const char *ShortDescription,
+ const char *FullDescription,
+ bool chain = false);
+
+ // get property definition
+ cmPropertyDefinition *GetPropertyDefinition
+ (const std::string& name, cmProperty::ScopeType scope);
+
+ // Is a property defined?
+ bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
+ bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
+
+ void SetLanguageEnabled(std::string const& l);
+ bool GetLanguageEnabled(std::string const& l) const;
+ std::vector<std::string> GetEnabledLanguages() const;
+ void ClearEnabledLanguages();
+
+ bool GetIsInTryCompile() const;
+ void SetIsInTryCompile(bool b);
+
+ cmCommand* GetCommand(std::string const& name) const;
+ void AddCommand(cmCommand* command);
+ void RemoveUnscriptableCommands();
+ void RenameCommand(std::string const& oldName, std::string const& newName);
+ void RemoveUserDefinedCommands();
+ std::vector<std::string> GetCommandNames() const;
+
+ void SetGlobalProperty(const std::string& prop, const char *value);
+ void AppendGlobalProperty(const std::string& prop,
+ const char *value,bool asString=false);
+ const char *GetGlobalProperty(const std::string& prop);
+ bool GetGlobalPropertyAsBool(const std::string& prop);
+
+private:
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
+ std::vector<std::string> EnabledLanguages;
+ std::map<std::string, cmCommand*> Commands;
+ cmPropertyMap GlobalProperties;
+ cmake* CMakeInstance;
+ bool IsInTryCompile;
+};
+
+#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5264123..95d05a6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1475,7 +1475,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType,
- bool verbose, std::string const& mtime)
+ bool verbose, std::string const& mtime,
+ std::string const& format)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1505,8 +1506,10 @@ bool cmSystemTools::CreateTar(const char* outFileName,
compress = cmArchiveWrite::CompressNone;
break;
}
+
cmArchiveWrite a(fout, compress,
- cmArchiveWrite::TypeTAR);
+ format.empty() ? "paxr" : format);
+
a.SetMTime(mtime);
a.SetVerbose(verbose);
for(std::vector<std::string>::const_iterator i = files.begin();
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index c59ae96..433ef46 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -395,7 +395,8 @@ public:
static bool CreateTar(const char* outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType, bool verbose,
- std::string const& mtime = std::string());
+ std::string const& mtime = std::string(),
+ std::string const& format = std::string());
static bool ExtractTar(const char* inFileName, 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 85e5165..f1540d4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -264,20 +264,6 @@ cmTarget::cmTarget()
this->LinkImplementationLanguageIsContextDependent = true;
}
-//----------------------------------------------------------------------------
-void cmTarget::DefineProperties(cmake *cm)
-{
- cm->DefineProperty
- ("RULE_LAUNCH_COMPILE", cmProperty::TARGET,
- "", "", true);
- cm->DefineProperty
- ("RULE_LAUNCH_LINK", cmProperty::TARGET,
- "", "", true);
- cm->DefineProperty
- ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET,
- "", "", true);
-}
-
void cmTarget::SetType(TargetType type, const std::string& name)
{
this->Name = name;
@@ -1157,7 +1143,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
}
// Get the list of configurations considered to be DEBUG.
- std::vector<std::string> const& debugConfigs =
+ std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
// Check if any entry in the list matches this configuration.
@@ -1182,7 +1168,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf,
if (this->RecordDependencies)
{
mf.AddCacheDefinition(depname, "",
- "Dependencies for target", cmCacheManager::STATIC);
+ "Dependencies for target", cmState::STATIC);
}
else
{
@@ -1216,7 +1202,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
}
// Get the list of configurations considered to be DEBUG.
- std::vector<std::string> const& debugConfigs =
+ std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string configString = "$<CONFIG:" + debugConfigs[0] + ">";
@@ -1370,7 +1356,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
dependencies += ";";
mf.AddCacheDefinition( targetEntry, dependencies.c_str(),
"Dependencies for the target",
- cmCacheManager::STATIC );
+ cmState::STATIC );
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a4ef977..a032414 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -34,7 +34,8 @@
F(CMP0041) \
F(CMP0042) \
F(CMP0046) \
- F(CMP0052)
+ F(CMP0052) \
+ F(CMP0060)
class cmake;
class cmMakefile;
@@ -488,9 +489,6 @@ public:
const char** imp,
std::string& suffix) const;
- // Define the properties
- static void DefineProperties(cmake *cm);
-
/** Get the macro to define when building sources in this target.
If no macro should be defined null is returned. */
const char* GetExportMacro() const;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 75c94c5..9be7d46 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
}
// Get the list of configurations considered to be DEBUG.
- std::vector<std::string> const& debugConfigs =
+ std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string prop;
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 8b68d64..c9e7a46 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmTryRunCommand.h"
-#include "cmCacheManager.h"
#include "cmTryCompileCommand.h"
#include <cmsys/FStream.hxx>
@@ -239,7 +238,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
}
this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar,
"Result of TRY_RUN",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
/* This is only used when cross compiling. Instead of running the
@@ -284,13 +283,14 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
this->Makefile->AddCacheDefinition(this->RunResultVariable,
"PLEASE_FILL_OUT-FAILED_TO_RUN",
comment.c_str(),
- cmCacheManager::STRING);
+ cmState::STRING);
- cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
- GetCacheIterator(this->RunResultVariable.c_str());
- if ( !it.IsAtEnd() )
+ cmState* state = this->Makefile->GetState();
+ const char* existingValue
+ = state->GetCacheEntryValue(this->RunResultVariable);
+ if (existingValue)
{
- it.SetProperty("ADVANCED", "1");
+ state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
}
error = true;
@@ -311,12 +311,14 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
this->Makefile->AddCacheDefinition(internalRunOutputName,
"PLEASE_FILL_OUT-NOTFOUND",
comment.c_str(),
- cmCacheManager::STRING);
- cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
- GetCacheIterator(internalRunOutputName.c_str());
- if ( !it.IsAtEnd() )
+ cmState::STRING);
+ cmState* state = this->Makefile->GetState();
+ const char* existing =
+ state->GetCacheEntryValue(internalRunOutputName);
+ if (existing)
{
- it.SetProperty("ADVANCED", "1");
+ state->SetCacheEntryProperty(internalRunOutputName,
+ "ADVANCED", "1");
}
error = true;
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index ee1ff29..10122e9 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmUtilitySourceCommand.h"
+#include "cmCacheManager.h"
+
// cmUtilitySourceCommand
bool cmUtilitySourceCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@@ -52,11 +54,13 @@ bool cmUtilitySourceCommand
}
else
{
+ cmCacheManager *manager =
+ this->Makefile->GetCMakeInstance()->GetCacheManager();
haveCacheValue = (cacheValue &&
(strstr(cacheValue, "(IntDir)") == 0 ||
(intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
- (this->Makefile->GetCacheMajorVersion() != 0 &&
- this->Makefile->GetCacheMinorVersion() != 0 ));
+ (manager->GetCacheMajorVersion() != 0 &&
+ manager->GetCacheMinorVersion() != 0 ));
}
if(haveCacheValue)
@@ -116,14 +120,14 @@ bool cmUtilitySourceCommand
this->Makefile->AddCacheDefinition(cacheEntry,
utilityExecutable.c_str(),
"Path to an internal program.",
- cmCacheManager::FILEPATH);
+ cmState::FILEPATH);
// add a value into the cache that maps from the
// full path to the name of the project
cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
this->Makefile->AddCacheDefinition(utilityExecutable,
utilityName.c_str(),
"Executable to project name.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
return true;
}
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 80c1286..1d33db1 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -10,7 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmVariableRequiresCommand.h"
-#include "cmCacheManager.h"
+#include "cmState.h"
// cmLibraryCommand
bool cmVariableRequiresCommand
@@ -34,6 +34,7 @@ bool cmVariableRequiresCommand
bool requirementsMet = true;
std::string notSet;
bool hasAdvanced = false;
+ cmState* state = this->Makefile->GetState();
for(unsigned int i = 2; i < args.size(); ++i)
{
if(!this->Makefile->IsOn(args[i]))
@@ -41,9 +42,8 @@ bool cmVariableRequiresCommand
requirementsMet = false;
notSet += args[i];
notSet += "\n";
- cmCacheManager::CacheIterator it =
- this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str());
- if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED"))
+ if(state->GetCacheEntryValue(args[i]) &&
+ state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
{
hasAdvanced = true;
}
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index 855e1ad..f30f700 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -31,7 +31,11 @@ void cmXCode21Object::PrintComment(std::ostream& out)
cmSystemTools::ReplaceString(this->Comment, "\"", "");
}
}
- out << "/* ";
+ if(this->Comment.empty())
+ {
+ return;
+ }
+ out << " /* ";
out << this->Comment;
out << " */";
}
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 5a90fd9..e72d315 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -81,7 +81,7 @@ void cmXCodeObject::Indent(int level, std::ostream& out)
{
while(level)
{
- out << " ";
+ out << "\t";
level--;
}
}
@@ -91,18 +91,15 @@ void cmXCodeObject::Print(std::ostream& out)
{
std::string separator = "\n";
int indentFactor = 1;
+ cmXCodeObject::Indent(2*indentFactor, out);
if(this->Version > 15
&& (this->IsA == PBXFileReference || this->IsA == PBXBuildFile))
{
separator = " ";
indentFactor = 0;
}
- cmXCodeObject::Indent(2*indentFactor, out);
- out << this->Id << " ";
- if(!(this->IsA == PBXGroup && this->Comment.size() == 0))
- {
- this->PrintComment(out);
- }
+ out << this->Id;
+ this->PrintComment(out);
out << " = {";
if(separator == "\n")
{
@@ -129,7 +126,7 @@ void cmXCodeObject::Print(std::ostream& out)
for(unsigned int k = 0; k < i->second->List.size(); k++)
{
cmXCodeObject::Indent(4*indentFactor, out);
- out << i->second->List[k]->Id << " ";
+ out << i->second->List[k]->Id;
i->second->List[k]->PrintComment(out);
out << "," << separator;
}
@@ -139,7 +136,11 @@ void cmXCodeObject::Print(std::ostream& out)
else if(object->TypeValue == ATTRIBUTE_GROUP)
{
std::map<std::string, cmXCodeObject*>::iterator j;
- out << i->first << " = {" << separator;
+ out << i->first << " = {";
+ if(separator == "\n")
+ {
+ out << separator;
+ }
for(j = object->ObjectAttributes.begin(); j !=
object->ObjectAttributes.end(); ++j)
{
@@ -188,7 +189,6 @@ void cmXCodeObject::Print(std::ostream& out)
out << " = " << object->Object->Id;
if(object->Object->HasComment() && i->first != "remoteGlobalIDString")
{
- out << " ";
object->Object->PrintComment(out);
}
out << ";" << separator;
@@ -243,7 +243,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
bool needQuote =
(String.empty() ||
String.find("//") != String.npos ||
- 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 bfe9aea..e624a83 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -21,6 +21,7 @@
#include "cmTest.h"
#include "cmDocumentationFormatter.h"
#include "cmAlgorithms.h"
+#include "cmState.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGraphVizWriter.h"
@@ -134,7 +135,7 @@ cmake::cmake()
this->FileComparison = new cmFileTimeComparison;
this->Policies = new cmPolicies();
- this->InitializeProperties();
+ this->State = new cmState(this);
#ifdef __APPLE__
struct rlimit rlp;
@@ -149,7 +150,6 @@ cmake::cmake()
#endif
this->Verbose = false;
- this->InTryCompile = false;
this->CacheManager = new cmCacheManager(this);
this->GlobalGenerator = 0;
this->ProgressCallback = 0;
@@ -172,12 +172,12 @@ cmake::~cmake()
{
delete this->CacheManager;
delete this->Policies;
+ delete this->State;
if (this->GlobalGenerator)
{
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
}
- cmDeleteAll(this->Commands);
cmDeleteAll(this->Generators);
#ifdef CMAKE_BUILD_WITH_CMAKE
delete this->VariableWatch;
@@ -185,130 +185,10 @@ cmake::~cmake()
delete this->FileComparison;
}
-void cmake::InitializeProperties()
-{
- this->Properties.clear();
- this->Properties.SetCMakeInstance(this);
- this->PropertyDefinitions.clear();
-
- // initialize properties
- cmTarget::DefineProperties(this);
- cmMakefile::DefineProperties(this);
-}
-
void cmake::CleanupCommandsAndMacros()
{
- this->InitializeProperties();
- std::vector<cmCommand*> commands;
- for(RegisteredCommandsMap::iterator j = this->Commands.begin();
- j != this->Commands.end(); ++j)
- {
- if ( !j->second->IsA("cmMacroHelperCommand") &&
- !j->second->IsA("cmFunctionHelperCommand"))
- {
- commands.push_back(j->second);
- }
- else
- {
- delete j->second;
- }
- }
- this->Commands.clear();
- std::vector<cmCommand*>::iterator it;
- for ( it = commands.begin(); it != commands.end();
- ++ it )
- {
- this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it;
- }
-}
-
-bool cmake::CommandExists(const std::string& name) const
-{
- std::string sName = cmSystemTools::LowerCase(name);
- return (this->Commands.find(sName) != this->Commands.end());
-}
-
-cmCommand *cmake::GetCommand(const std::string& name)
-{
- cmCommand* rm = 0;
- std::string sName = cmSystemTools::LowerCase(name);
- RegisteredCommandsMap::iterator pos = this->Commands.find(sName);
- if (pos != this->Commands.end())
- {
- rm = (*pos).second;
- }
- return rm;
-}
-
-void cmake::RenameCommand(const std::string& oldName,
- const std::string& newName)
-{
- // if the command already exists, free the old one
- std::string sOldName = cmSystemTools::LowerCase(oldName);
- std::string sNewName = cmSystemTools::LowerCase(newName);
- RegisteredCommandsMap::iterator pos = this->Commands.find(sOldName);
- if ( pos == this->Commands.end() )
- {
- return;
- }
- cmCommand* cmd = pos->second;
-
- pos = this->Commands.find(sNewName);
- if (pos != this->Commands.end())
- {
- delete pos->second;
- this->Commands.erase(pos);
- }
- this->Commands.insert(RegisteredCommandsMap::value_type(sNewName, cmd));
- pos = this->Commands.find(sOldName);
- this->Commands.erase(pos);
-}
-
-void cmake::RemoveCommand(const std::string& name)
-{
- std::string sName = cmSystemTools::LowerCase(name);
- RegisteredCommandsMap::iterator pos = this->Commands.find(sName);
- if ( pos != this->Commands.end() )
- {
- delete pos->second;
- this->Commands.erase(pos);
- }
-}
-
-void cmake::AddCommand(cmCommand* wg)
-{
- std::string name = cmSystemTools::LowerCase(wg->GetName());
- // if the command already exists, free the old one
- RegisteredCommandsMap::iterator pos = this->Commands.find(name);
- if (pos != this->Commands.end())
- {
- delete pos->second;
- this->Commands.erase(pos);
- }
- this->Commands.insert( RegisteredCommandsMap::value_type(name, wg));
-}
-
-
-void cmake::RemoveUnscriptableCommands()
-{
- std::vector<std::string> unscriptableCommands;
- cmake::RegisteredCommandsMap* commands = this->GetCommands();
- for (cmake::RegisteredCommandsMap::const_iterator pos = commands->begin();
- pos != commands->end();
- ++pos)
- {
- if (!pos->second->IsScriptable())
- {
- unscriptableCommands.push_back(pos->first);
- }
- }
-
- for(std::vector<std::string>::const_iterator it=unscriptableCommands.begin();
- it != unscriptableCommands.end();
- ++it)
- {
- this->RemoveCommand(*it);
- }
+ this->State->Initialize();
+ this->State->RemoveUserDefinedCommands();
}
// Parse the args
@@ -335,7 +215,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
std::string var, value;
- cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+ cmState::CacheEntryType type = cmState::UNINITIALIZED;
if(cmCacheManager::ParseEntry(entry, var, value, type))
{
// The value is transformed if it is a filepath for example, so
@@ -345,20 +225,20 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
std::string cachedValue;
if(this->WarnUnusedCli)
{
- if(const char *v = this->CacheManager->GetCacheValue(var))
+ if(const char *v = this->State->GetInitializedCacheValue(var))
{
haveValue = true;
cachedValue = v;
}
}
- this->CacheManager->AddCacheEntry(var, value.c_str(),
+ this->State->AddCacheEntry(var, value.c_str(),
"No help, variable specified on the command line.", type);
if(this->WarnUnusedCli)
{
if (!haveValue ||
- cachedValue != this->CacheManager->GetCacheValue(var))
+ cachedValue != this->State->GetInitializedCacheValue(var))
{
this->WatchUnusedCli(var);
}
@@ -402,17 +282,16 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
//go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete;
- cmCacheManager::CacheIterator it =
- this->CacheManager->GetCacheIterator();
- for ( it.Begin(); !it.IsAtEnd(); it.Next() )
+ std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
+ for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it)
{
- cmCacheManager::CacheEntryType t = it.GetType();
- if(t != cmCacheManager::STATIC)
+ cmState::CacheEntryType t = this->State->GetCacheEntryType(*it);
+ if(t != cmState::STATIC)
{
- std::string entryName = it.GetName();
- if (regex.find(entryName.c_str()))
+ if (regex.find(it->c_str()))
{
- entriesToDelete.push_back(entryName);
+ entriesToDelete.push_back(*it);
}
}
}
@@ -423,7 +302,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
currentEntry != entriesToDelete.end();
++currentEntry)
{
- this->CacheManager->RemoveCacheEntry(*currentEntry);
+ this->State->RemoveCacheEntry(*currentEntry);
}
}
else if(arg.find("-C",0) == 0)
@@ -816,6 +695,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
if(i >= args.size())
{
cmSystemTools::Error("No generator specified for -G");
+ this->PrintGeneratorList();
return;
}
value = args[i];
@@ -826,6 +706,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
{
cmSystemTools::Error("Could not create named generator ",
value.c_str());
+ this->PrintGeneratorList();
}
else
{
@@ -843,12 +724,8 @@ void cmake::SetArgs(const std::vector<std::string>& args,
{
this->SetHomeOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetStartOutputDirectory
- (cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
- this->SetStartDirectory
- (cmSystemTools::GetCurrentWorkingDirectory());
}
this->SetStartDirectory(this->GetHomeDirectory());
@@ -916,16 +793,18 @@ void cmake::SetDirectoriesFromFile(const char* arg)
// If there is a CMakeCache.txt file, use its settings.
if(!cachePath.empty())
{
- cmCacheManager* cachem = this->GetCacheManager();
- cmCacheManager::CacheIterator it = cachem->NewIterator();
- if(cachem->LoadCache(cachePath) &&
- it.Find("CMAKE_HOME_DIRECTORY"))
+ if(this->LoadCache(cachePath))
{
- this->SetHomeOutputDirectory(cachePath);
- this->SetStartOutputDirectory(cachePath);
- this->SetHomeDirectory(it.GetValue());
- this->SetStartDirectory(it.GetValue());
- return;
+ const char* existingValue =
+ this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
+ if (existingValue)
+ {
+ this->SetHomeOutputDirectory(cachePath);
+ this->SetStartOutputDirectory(cachePath);
+ this->SetHomeDirectory(existingValue);
+ this->SetStartDirectory(existingValue);
+ return;
+ }
}
}
@@ -971,14 +850,14 @@ int cmake::AddCMakePaths()
// Save the value in the cache
this->CacheManager->AddCacheEntry
("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(),
- "Path to CMake executable.", cmCacheManager::INTERNAL);
+ "Path to CMake executable.", cmState::INTERNAL);
#ifdef CMAKE_BUILD_WITH_CMAKE
this->CacheManager->AddCacheEntry
("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
- "Path to ctest program executable.", cmCacheManager::INTERNAL);
+ "Path to ctest program executable.", cmState::INTERNAL);
this->CacheManager->AddCacheEntry
("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
- "Path to cpack program executable.", cmCacheManager::INTERNAL);
+ "Path to cpack program executable.", cmState::INTERNAL);
#endif
if(!cmSystemTools::FileExists(
(cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str()))
@@ -992,7 +871,7 @@ int cmake::AddCMakePaths()
}
this->CacheManager->AddCacheEntry
("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
- "Path to CMake installation.", cmCacheManager::INTERNAL);
+ "Path to CMake installation.", cmState::INTERNAL);
return 1;
}
@@ -1110,12 +989,44 @@ void cmake::SetHomeDirectory(const std::string& dir)
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
}
-void cmake::SetHomeOutputDirectory(const std::string& lib)
+const char* cmake::GetHomeDirectory() const
+{
+ return this->cmHomeDirectory.c_str();
+}
+
+void cmake::SetHomeOutputDirectory(const std::string& dir)
{
- this->HomeOutputDirectory = lib;
+ this->HomeOutputDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
}
+const char* cmake::GetHomeOutputDirectory() const
+{
+ return this->HomeOutputDirectory.c_str();
+}
+
+const char* cmake::GetStartDirectory() const
+{
+ return this->cmStartDirectory.c_str();
+}
+
+void cmake::SetStartDirectory(const std::string& dir)
+{
+ this->cmStartDirectory = dir;
+ cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
+}
+
+const char* cmake::GetStartOutputDirectory() const
+{
+ return this->StartOutputDirectory.c_str();
+}
+
+void cmake::SetStartOutputDirectory(const std::string& dir)
+{
+ this->StartOutputDirectory = dir;
+ cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
+}
+
void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{
if(!gg)
@@ -1204,10 +1115,10 @@ int cmake::DoPreConfigureChecks()
}
// do a sanity check on some values
- if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
+ if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"))
{
std::string cacheStart =
- this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
cacheStart += "/CMakeLists.txt";
std::string currentStart = this->GetHomeDirectory();
currentStart += "/CMakeLists.txt";
@@ -1234,7 +1145,7 @@ struct SaveCacheEntry
std::string key;
std::string value;
std::string help;
- cmCacheManager::CacheEntryType type;
+ cmState::CacheEntryType type;
};
int cmake::HandleDeleteCacheVariables(const std::string& var)
@@ -1242,12 +1153,12 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
std::vector<std::string> argsSplit;
cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true);
// erase the property to avoid infinite recursion
- this->SetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
- if(this->GetIsInTryCompile())
+ this->State
+ ->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
+ if(this->State->GetIsInTryCompile())
{
return 0;
}
- cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved;
std::ostringstream warning;
warning
@@ -1263,10 +1174,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
i++;
save.value = *i;
warning << *i << "\n";
- if(ci.Find(save.key))
+ const char* existingValue =
+ this->CacheManager->GetCacheEntryValue(save.key);
+ if(existingValue)
{
- save.type = ci.GetType();
- if(const char* help = ci.GetProperty("HELPSTRING"))
+ save.type = this->CacheManager->GetCacheEntryType(save.key);
+ if(const char* help =
+ this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING"))
{
save.help = help;
}
@@ -1305,7 +1219,7 @@ int cmake::Configure()
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE",
"Suppress Warnings that are meant for"
" the author of the CMakeLists.txt files.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
else
{
@@ -1313,12 +1227,12 @@ int cmake::Configure()
AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE",
"Suppress Warnings that are meant for"
" the author of the CMakeLists.txt files.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
}
int ret = this->ActualConfigure();
- const char* delCacheVars =
- this->GetProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
+ const char* delCacheVars = this->State
+ ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
if(delCacheVars && delCacheVars[0] != 0)
{
return this->HandleDeleteCacheVariables(delCacheVars);
@@ -1349,16 +1263,16 @@ int cmake::ActualConfigure()
this->GetHomeDirectory(),
"Start directory with the top level CMakeLists.txt file for this "
"project",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
// no generator specified on the command line
if(!this->GlobalGenerator)
{
const char* genName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR");
const char* extraGenName =
- this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
if(genName)
{
std::string fullName = cmExternalMakefileProjectGenerator::
@@ -1436,7 +1350,8 @@ int cmake::ActualConfigure()
}
}
- const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+ const char* genName = this->CacheManager
+ ->GetInitializedCacheValue("CMAKE_GENERATOR");
if(genName)
{
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
@@ -1452,20 +1367,20 @@ int cmake::ActualConfigure()
return -2;
}
}
- if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
+ if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"))
{
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName().c_str(),
"Name of generator.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName().c_str(),
"Name of external makefile project generator.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
if(const char* platformName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM"))
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM"))
{
if(this->GeneratorPlatform.empty())
{
@@ -1489,11 +1404,11 @@ int cmake::ActualConfigure()
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
this->GeneratorPlatform.c_str(),
"Name of generator platform.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
if(const char* tsName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET"))
{
if(this->GeneratorToolset.empty())
{
@@ -1517,20 +1432,16 @@ int cmake::ActualConfigure()
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
this->GeneratorToolset.c_str(),
"Name of generator toolset.",
- cmCacheManager::INTERNAL);
+ cmState::INTERNAL);
}
// reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time
- if (!this->InTryCompile)
+ if (!this->State->GetIsInTryCompile())
{
this->GlobalGenerator->ClearEnabledLanguages();
- }
- // Truncate log files
- if (!this->InTryCompile)
- {
this->TruncateOutputLog("CMakeOutput.log");
this->TruncateOutputLog("CMakeError.log");
}
@@ -1547,51 +1458,56 @@ int cmake::ActualConfigure()
// project requires compatibility with CMake 2.4. We detect this
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
// variable created when CMP0001 is not set to NEW.
- if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+ if(this->State
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
{
- if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH"))
+ if(!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
{
- this->CacheManager->AddCacheEntry
+ this->State->AddCacheEntry
("LIBRARY_OUTPUT_PATH", "",
"Single output directory for building all libraries.",
- cmCacheManager::PATH);
+ cmState::PATH);
}
- if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH"))
+ if(!this->State
+ ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
{
- this->CacheManager->AddCacheEntry
+ this->State->AddCacheEntry
("EXECUTABLE_OUTPUT_PATH", "",
"Single output directory for building all executables.",
- cmCacheManager::PATH);
+ cmState::PATH);
}
}
- if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
+ if(!this->State
+ ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
{
- this->CacheManager->AddCacheEntry
+ this->State->AddCacheEntry
("CMAKE_USE_RELATIVE_PATHS", "OFF",
"If true, cmake will use relative paths in makefiles and projects.",
- cmCacheManager::BOOL);
- cmCacheManager::CacheIterator it =
- this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS");
- if ( !it.PropertyExists("ADVANCED") )
+ cmState::BOOL);
+ if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
+ "ADVANCED"))
{
- it.SetProperty("ADVANCED", "1");
+ this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
+ "ADVANCED", "1");
}
}
- if(cmSystemTools::GetFatalErrorOccured() &&
- (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
- cmSystemTools::IsOff(this->CacheManager->
- GetCacheValue("CMAKE_MAKE_PROGRAM"))))
+ if(cmSystemTools::GetFatalErrorOccured())
{
- // We must have a bad generator selection. Wipe the cache entry so the
- // user can select another.
- this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR");
- this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
+ const char* makeProgram =
+ this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM");
+ if (!makeProgram || cmSystemTools::IsOff(makeProgram))
+ {
+ // We must have a bad generator selection. Wipe the cache entry so the
+ // user can select another.
+ this->State->RemoveCacheEntry("CMAKE_GENERATOR");
+ this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
+ }
}
cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
if (mf->IsOn("CTEST_USE_LAUNCHERS")
- && !this->GetProperty("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL))
+ && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE"))
{
cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the "
"RULE_LAUNCH_COMPILE global property is not defined.\n"
@@ -1792,24 +1708,24 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
{
this->CacheManager->AddCacheEntry(key, value,
helpString,
- cmCacheManager::CacheEntryType(type));
+ cmState::CacheEntryType(type));
}
const char* cmake::GetCacheDefinition(const std::string& name) const
{
- return this->CacheManager->GetCacheValue(name);
+ return this->CacheManager->GetInitializedCacheValue(name);
}
void cmake::AddDefaultCommands()
{
- std::list<cmCommand*> commands;
+ std::vector<cmCommand*> commands;
GetBootstrapCommands1(commands);
GetBootstrapCommands2(commands);
GetPredefinedCommands(commands);
- for(std::list<cmCommand*>::iterator i = commands.begin();
+ for(std::vector<cmCommand*>::iterator i = commands.begin();
i != commands.end(); ++i)
{
- this->AddCommand(*i);
+ this->State->AddCommand(*i);
}
}
@@ -1818,23 +1734,23 @@ void cmake::AddDefaultGenerators()
#if defined(_WIN32) && !defined(__CYGWIN__)
# if !defined(CMAKE_BOOT_MINGW)
this->Generators.push_back(
- cmGlobalVisualStudio6Generator::NewFactory());
- this->Generators.push_back(
- cmGlobalVisualStudio7Generator::NewFactory());
+ cmGlobalVisualStudio14Generator::NewFactory());
this->Generators.push_back(
- cmGlobalVisualStudio10Generator::NewFactory());
+ cmGlobalVisualStudio12Generator::NewFactory());
this->Generators.push_back(
cmGlobalVisualStudio11Generator::NewFactory());
this->Generators.push_back(
- cmGlobalVisualStudio12Generator::NewFactory());
+ cmGlobalVisualStudio10Generator::NewFactory());
this->Generators.push_back(
- cmGlobalVisualStudio14Generator::NewFactory());
+ cmGlobalVisualStudio9Generator::NewFactory());
+ this->Generators.push_back(
+ cmGlobalVisualStudio8Generator::NewFactory());
this->Generators.push_back(
cmGlobalVisualStudio71Generator::NewFactory());
this->Generators.push_back(
- cmGlobalVisualStudio8Generator::NewFactory());
+ cmGlobalVisualStudio7Generator::NewFactory());
this->Generators.push_back(
- cmGlobalVisualStudio9Generator::NewFactory());
+ cmGlobalVisualStudio6Generator::NewFactory());
this->Generators.push_back(
cmGlobalBorlandMakefileGenerator::NewFactory());
this->Generators.push_back(
@@ -1863,10 +1779,18 @@ void cmake::AddDefaultGenerators()
#endif
}
+bool cmake::ParseCacheEntry(const std::string& entry,
+ std::string& var,
+ std::string& value,
+ cmState::CacheEntryType& type)
+{
+ return cmCacheManager::ParseEntry(entry, var, value, type);
+}
+
int cmake::LoadCache()
{
// could we not read the cache
- if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory()))
+ if (!this->LoadCache(this->GetHomeOutputDirectory()))
{
// if it does exist, but isn't readable then warn the user
std::string cacheFile = this->GetHomeOutputDirectory();
@@ -1889,6 +1813,28 @@ int cmake::LoadCache()
return 0;
}
+bool cmake::LoadCache(const std::string& path)
+{
+ return this->CacheManager->LoadCache(path);
+}
+
+bool cmake::LoadCache(const std::string& path, bool internal,
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes)
+{
+ return this->CacheManager->LoadCache(path, internal, excludes, includes);
+}
+
+bool cmake::SaveCache(const std::string& path)
+{
+ return this->CacheManager->SaveCache(path);
+}
+
+bool cmake::DeleteCache(const std::string& path)
+{
+ return this->CacheManager->DeleteCache(path);
+}
+
void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
{
this->ProgressCallback = f;
@@ -1897,13 +1843,23 @@ void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
void cmake::UpdateProgress(const char *msg, float prog)
{
- if(this->ProgressCallback && !this->InTryCompile)
+ if(this->ProgressCallback && !this->State->GetIsInTryCompile())
{
(*this->ProgressCallback)(msg, prog, this->ProgressCallbackClientData);
return;
}
}
+bool cmake::GetIsInTryCompile() const
+{
+ return this->State->GetIsInTryCompile();
+}
+
+void cmake::SetIsInTryCompile(bool b)
+{
+ this->State->SetIsInTryCompile(b);
+}
+
void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
{
for(RegisteredGeneratorsVector::const_iterator i =
@@ -1925,11 +1881,24 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
}
}
+void cmake::PrintGeneratorList()
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ cmDocumentation doc;
+ std::vector<cmDocumentationEntry> generators;
+ this->GetGeneratorDocumentation(generators);
+ doc.AppendSection("Generators",generators);
+ std::cerr << "\n";
+ doc.PrintDocumentation(cmDocumentation::ListGenerators, std::cerr);
+#endif
+}
+
void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
const char* tablepath =
- this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
+ this->CacheManager
+ ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if(tablepath)
{
@@ -2163,7 +2132,7 @@ void cmake::TruncateOutputLog(const char* fname)
{
return;
}
- if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+ if (!this->State->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"))
{
cmSystemTools::RemoveFile(fullPath);
return;
@@ -2211,135 +2180,25 @@ void cmake::GenerateGraphViz(const char* fileName) const
#endif
}
-void cmake::DefineProperty(const std::string& name,
- cmProperty::ScopeType scope,
- const char *ShortDescription,
- const char *FullDescription,
- bool chained)
-{
- this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
- FullDescription,
- chained);
-}
-
-cmPropertyDefinition *cmake
-::GetPropertyDefinition(const std::string& name,
- cmProperty::ScopeType scope)
-{
- if (this->IsPropertyDefined(name,scope))
- {
- return &(this->PropertyDefinitions[scope][name]);
- }
- return 0;
-}
-
-bool cmake::IsPropertyDefined(const std::string& name,
- cmProperty::ScopeType scope)
-{
- return this->PropertyDefinitions[scope].IsPropertyDefined(name);
-}
-
-bool cmake::IsPropertyChained(const std::string& name,
- cmProperty::ScopeType scope)
-{
- return this->PropertyDefinitions[scope].IsPropertyChained(name);
-}
-
void cmake::SetProperty(const std::string& prop, const char* value)
{
- // Special hook to invalidate cached value.
- if(prop == "DEBUG_CONFIGURATIONS")
- {
- this->DebugConfigs.clear();
- }
-
- this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
+ this->State->SetGlobalProperty(prop, value);
}
void cmake::AppendProperty(const std::string& prop,
const char* value, bool asString)
{
- // Special hook to invalidate cached value.
- if(prop == "DEBUG_CONFIGURATIONS")
- {
- this->DebugConfigs.clear();
- }
-
- this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
+ this->State->AppendGlobalProperty(prop, value, asString);
}
const char *cmake::GetProperty(const std::string& prop)
{
- return this->GetProperty(prop, cmProperty::GLOBAL);
-}
-
-const char *cmake::GetProperty(const std::string& prop,
- cmProperty::ScopeType scope)
-{
- // watch for special properties
- std::string output = "";
- if ( prop == "CACHE_VARIABLES" )
- {
- cmCacheManager::CacheIterator cit =
- this->GetCacheManager()->GetCacheIterator();
- for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
- {
- if (!output.empty())
- {
- output += ";";
- }
- output += cit.GetName();
- }
- this->SetProperty("CACHE_VARIABLES", output.c_str());
- }
- else if ( prop == "COMMANDS" )
- {
- cmake::RegisteredCommandsMap::iterator cmds
- = this->GetCommands()->begin();
- for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds )
- {
- if ( cc > 0 )
- {
- output += ";";
- }
- output += cmds->first.c_str();
- cc++;
- }
- this->SetProperty("COMMANDS",output.c_str());
- }
- else if ( prop == "IN_TRY_COMPILE" )
- {
- this->SetProperty("IN_TRY_COMPILE",
- this->GetIsInTryCompile()? "1":"0");
- }
- else if ( prop == "ENABLED_LANGUAGES" )
- {
- std::string lang;
- if(this->GlobalGenerator)
- {
- std::vector<std::string> enLangs;
- this->GlobalGenerator->GetEnabledLanguages(enLangs);
- lang = cmJoin(enLangs, ";");
- }
- this->SetProperty("ENABLED_LANGUAGES", lang.c_str());
- }
-#define STRING_LIST_ELEMENT(F) ";" #F
- if (prop == "CMAKE_C_KNOWN_FEATURES")
- {
- return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1;
- }
- if (prop == "CMAKE_CXX_KNOWN_FEATURES")
- {
- return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
- }
-#undef STRING_LIST_ELEMENT
- bool dummy = false;
- return this->Properties.GetPropertyValue(prop, scope, dummy);
+ return this->State->GetGlobalProperty(prop);
}
bool cmake::GetPropertyAsBool(const std::string& prop)
{
- return cmSystemTools::IsOn(this->GetProperty(prop));
+ return this->State->GetGlobalPropertyAsBool(prop);
}
cmInstalledFile *cmake::GetOrCreateInstalledFile(
@@ -2409,6 +2268,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
if(i >= args.size())
{
cmSystemTools::Error("No generator specified for -G");
+ this->PrintGeneratorList();
return -1;
}
value = args[i];
@@ -2419,6 +2279,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
{
cmSystemTools::Error("Could not create named generator ",
value.c_str());
+ this->PrintGeneratorList();
}
else
{
@@ -2442,7 +2303,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files
this->AddCMakePaths();
std::string modulesPath =
- this->CacheManager->GetCacheValue("CMAKE_ROOT");
+ this->State->GetInitializedCacheValue("CMAKE_ROOT");
modulesPath += "/Modules";
std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake";
@@ -2652,9 +2513,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
if(t == cmake::AUTHOR_WARNING)
{
// Allow suppression of these warnings.
- cmCacheManager::CacheIterator it = this->CacheManager
- ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- if(!it.IsAtEnd() && it.GetValueAsBool())
+ const char* suppress = this->State->GetCacheEntryValue(
+ "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+ if(suppress && cmSystemTools::IsOn(suppress))
{
return;
}
@@ -2730,27 +2591,25 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
}
//----------------------------------------------------------------------------
-std::vector<std::string> const& cmake::GetDebugConfigs()
+std::vector<std::string> cmake::GetDebugConfigs()
{
- // Compute on-demand.
- if(this->DebugConfigs.empty())
+ std::vector<std::string> configs;
+ if(const char* config_list =
+ this->State->GetGlobalProperty("DEBUG_CONFIGURATIONS"))
{
- if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS"))
- {
- // Expand the specified list and convert to upper-case.
- cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs);
- std::transform(this->DebugConfigs.begin(),
- this->DebugConfigs.end(),
- this->DebugConfigs.begin(),
- cmSystemTools::UpperCase);
- }
- // If no configurations were specified, use a default list.
- if(this->DebugConfigs.empty())
- {
- this->DebugConfigs.push_back("DEBUG");
- }
+ // Expand the specified list and convert to upper-case.
+ cmSystemTools::ExpandListArgument(config_list, configs);
+ std::transform(configs.begin(),
+ configs.end(),
+ configs.begin(),
+ cmSystemTools::UpperCase);
+ }
+ // If no configurations were specified, use a default list.
+ if(configs.empty())
+ {
+ configs.push_back("DEBUG");
}
- return this->DebugConfigs;
+ return configs;
}
@@ -2767,38 +2626,42 @@ int cmake::Build(const std::string& dir,
}
std::string cachePath = dir;
cmSystemTools::ConvertToUnixSlashes(cachePath);
- cmCacheManager* cachem = this->GetCacheManager();
- cmCacheManager::CacheIterator it = cachem->NewIterator();
- if(!cachem->LoadCache(cachePath))
+ if(!this->LoadCache(cachePath))
{
std::cerr << "Error: could not load cache\n";
return 1;
}
- if(!it.Find("CMAKE_GENERATOR"))
+ const char* cachedGenerator =
+ this->State->GetCacheEntryValue("CMAKE_GENERATOR");
+ if(!cachedGenerator)
{
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
cmsys::auto_ptr<cmGlobalGenerator> gen(
- this->CreateGlobalGenerator(it.GetValue()));
+ this->CreateGlobalGenerator(cachedGenerator));
if(!gen.get())
{
std::cerr << "Error: could create CMAKE_GENERATOR \""
- << it.GetValue() << "\"\n";
+ << cachedGenerator << "\"\n";
return 1;
}
std::string output;
std::string projName;
- if(!it.Find("CMAKE_PROJECT_NAME"))
+ const char* cachedProjectName =
+ this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
+ if(!cachedProjectName)
{
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
return 1;
}
- projName = it.GetValue();
+ projName = cachedProjectName;
bool verbose = false;
- if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
+ const char* cachedVerbose =
+ this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
+ if(cachedVerbose)
{
- verbose = it.GetValueAsBool();
+ verbose = cmSystemTools::IsOn(cachedVerbose);
}
return gen->Build("", dir,
projName, target,
diff --git a/Source/cmake.h b/Source/cmake.h
index c22b329..352850d 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -15,16 +15,14 @@
#include "cmListFileCache.h"
#include "cmSystemTools.h"
-#include "cmPropertyDefinitionMap.h"
-#include "cmPropertyMap.h"
#include "cmInstalledFile.h"
+#include "cmCacheManager.h"
+#include "cmState.h"
class cmGlobalGeneratorFactory;
class cmGlobalGenerator;
class cmLocalGenerator;
-class cmCacheManager;
class cmMakefile;
-class cmCommand;
class cmVariableWatch;
class cmFileTimeComparison;
class cmExternalMakefileProjectGenerator;
@@ -32,6 +30,7 @@ class cmDocumentationSection;
class cmPolicies;
class cmTarget;
class cmGeneratedFileStream;
+class cmState;
/** \brief Represents a cmake invocation.
*
@@ -92,7 +91,6 @@ class cmake
*/
FIND_PACKAGE_MODE
};
- typedef std::map<std::string, cmCommand*> RegisteredCommandsMap;
typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
/// Default constructor
@@ -113,15 +111,9 @@ class cmake
* and going up until it reaches the HomeDirectory.
*/
void SetHomeDirectory(const std::string& dir);
- const char* GetHomeDirectory() const
- {
- return this->cmHomeDirectory.c_str();
- }
- void SetHomeOutputDirectory(const std::string& lib);
- const char* GetHomeOutputDirectory() const
- {
- return this->HomeOutputDirectory.c_str();
- }
+ const char* GetHomeDirectory() const;
+ void SetHomeOutputDirectory(const std::string& dir);
+ const char* GetHomeOutputDirectory() const;
//@}
//@{
@@ -132,24 +124,10 @@ class cmake
* recursing up the tree starting at the StartDirectory and going up until
* it reaches the HomeDirectory.
*/
- void SetStartDirectory(const std::string& dir)
- {
- this->cmStartDirectory = dir;
- cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
- }
- const char* GetStartDirectory() const
- {
- return this->cmStartDirectory.c_str();
- }
- void SetStartOutputDirectory(const std::string& lib)
- {
- this->StartOutputDirectory = lib;
- cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
- }
- const char* GetStartOutputDirectory() const
- {
- return this->StartOutputDirectory.c_str();
- }
+ void SetStartDirectory(const std::string& dir);
+ const char* GetStartDirectory() const;
+ void SetStartOutputDirectory(const std::string& dir);
+ const char* GetStartOutputDirectory() const;
//@}
/**
@@ -173,7 +151,19 @@ class cmake
int Configure();
int ActualConfigure();
+ ///! Break up a line like VAR:type="value" into var, type and value
+ static bool ParseCacheEntry(const std::string& entry,
+ std::string& var,
+ std::string& value,
+ cmState::CacheEntryType& type);
+
int LoadCache();
+ bool LoadCache(const std::string& path);
+ bool LoadCache(const std::string& path, bool internal,
+ std::set<std::string>& excludes,
+ std::set<std::string>& includes);
+ bool SaveCache(const std::string& path);
+ bool DeleteCache(const std::string& path);
void PreLoadCMakeFiles();
///! Create a GlobalGenerator
@@ -224,34 +214,13 @@ class cmake
*/
int GetSystemInformation(std::vector<std::string>&);
- /**
- * Add a command to this cmake instance
- */
- void AddCommand(cmCommand* );
- void RenameCommand(const std::string& oldName, const std::string& newName);
- void RemoveCommand(const std::string& name);
- void RemoveUnscriptableCommands();
-
- /**
- * Get a command by its name
- */
- cmCommand *GetCommand(const std::string& name);
-
- /** Get list of all commands */
- RegisteredCommandsMap* GetCommands() { return &this->Commands; }
-
- /** Check if a command exists. */
- bool CommandExists(const std::string& name) const;
-
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&,
bool directoriesSetBefore = false);
///! Is this cmake running as a result of a TRY_COMPILE command
- bool GetIsInTryCompile() { return this->InTryCompile; }
-
- ///! Is this cmake running as a result of a TRY_COMPILE command
- void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
+ bool GetIsInTryCompile() const;
+ void SetIsInTryCompile(bool b);
///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
@@ -283,8 +252,6 @@ class cmake
void AppendProperty(const std::string& prop,
const char *value,bool asString=false);
const char *GetProperty(const std::string& prop);
- const char *GetProperty(const std::string& prop,
- cmProperty::ScopeType scope);
bool GetPropertyAsBool(const std::string& prop);
///! Get or create an cmInstalledFile instance and return a pointer to it
@@ -334,23 +301,9 @@ class cmake
void MarkCliAsUsed(const std::string& variable);
- // Define a property
- void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
- const char *ShortDescription,
- const char *FullDescription,
- bool chain = false);
-
- // get property definition
- cmPropertyDefinition *GetPropertyDefinition
- (const std::string& name, cmProperty::ScopeType scope);
-
- // Is a property defined?
- bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
- bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
-
/** Get the list of configurations (in upper case) considered to be
debugging configurations.*/
- std::vector<std::string> const& GetDebugConfigs();
+ std::vector<std::string> GetDebugConfigs();
void SetCMakeEditCommand(std::string const& s)
{ this->CMakeEditCommand = s; }
@@ -375,21 +328,19 @@ class cmake
void UnwatchUnusedCli(const std::string& var);
void WatchUnusedCli(const std::string& var);
+
+ cmState* GetState() const { return this->State; }
+
protected:
void RunCheckForUnusedVariables();
void InitializeProperties();
int HandleDeleteCacheVariables(const std::string& var);
- cmPropertyMap Properties;
-
- std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
- PropertyDefinitions;
typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
typedef std::map<std::string,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
- RegisteredCommandsMap Commands;
RegisteredGeneratorsVector Generators;
RegisteredExtraGeneratorsMap ExtraGenerators;
void AddDefaultCommands();
@@ -460,10 +411,14 @@ private:
bool DebugTryCompile;
cmFileTimeComparison* FileComparison;
std::string GraphVizFile;
- std::vector<std::string> DebugConfigs;
InstalledFilesMap InstalledFiles;
+ cmState* State;
+
void UpdateConversionPathTable();
+
+ // Print a list of valid generators to stderr.
+ void PrintGeneratorList();
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index ac73ad0..c8cf2d4 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -18,7 +18,7 @@
#include "cmake.h"
#include "cmcmd.h"
-#include "cmCacheManager.h"
+#include "cmState.h"
#include "cmListFileCache.h"
#include "cmSourceFile.h"
#include "cmGlobalGenerator.h"
@@ -328,25 +328,29 @@ int do_cmake(int ac, char const* const* av)
int res = cm.Run(args, view_only);
if ( list_cached || list_all_cached )
{
- cmCacheManager::CacheIterator it =
- cm.GetCacheManager()->GetCacheIterator();
std::cout << "-- Cache values" << std::endl;
- for ( it.Begin(); !it.IsAtEnd(); it.Next() )
+ std::vector<std::string> keys = cm.GetState()->GetCacheEntryKeys();
+ for (std::vector<std::string>::const_iterator it = keys.begin();
+ it != keys.end(); ++it)
{
- cmCacheManager::CacheEntryType t = it.GetType();
- if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
- t != cmCacheManager::UNINITIALIZED )
+ cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it);
+ if (t != cmState::INTERNAL && t != cmState::STATIC &&
+ t != cmState::UNINITIALIZED)
{
- bool advanced = it.PropertyExists("ADVANCED");
- if ( list_all_cached || !advanced)
+ const char* advancedProp =
+ cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED");
+ if ( list_all_cached || !advancedProp)
{
if ( list_help )
{
- std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl;
+ std::cout << "// "
+ << cm.GetState()->GetCacheEntryProperty(*it,
+ "HELPSTRING") << std::endl;
}
- std::cout << it.GetName() << ":" <<
- cmCacheManager::TypeToString(it.GetType())
- << "=" << it.GetValue() << std::endl;
+ std::cout << *it << ":" <<
+ cmState::CacheEntryTypeToString(t)
+ << "=" << cm.GetState()->GetCacheEntryValue(*it)
+ << std::endl;
if ( list_help )
{
std::cout << std::endl;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9f2ea46..2ef04ef 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -703,10 +703,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Tar files
else if (args[1] == "tar" && args.size() > 3)
{
+ const char* knownFormats[] =
+ {
+ "7zip",
+ "gnutar",
+ "pax",
+ "paxr",
+ "zip"
+ };
+
std::string flags = args[2];
std::string outFile = args[3];
std::vector<std::string> files;
std::string mtime;
+ std::string format;
bool doing_options = true;
for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
@@ -729,6 +739,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
}
+ else if (cmHasLiteralPrefix(arg, "--format="))
+ {
+ format = arg.substr(9);
+ bool isKnown = std::find(cmArrayBegin(knownFormats),
+ cmArrayEnd(knownFormats), format) != cmArrayEnd(knownFormats);
+
+ if(!isKnown)
+ {
+ cmSystemTools::Error("Unknown -E tar --format= argument: ",
+ format.c_str());
+ return 1;
+ }
+ }
else
{
cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str());
@@ -759,7 +782,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
compress = cmSystemTools::TarCompressGZip;
++nCompress;
}
- if ( nCompress > 1 )
+ if ( (format == "7zip" || format == "zip") && nCompress > 0 )
+ {
+ cmSystemTools::Error("Can not use compression flags with format: ",
+ format.c_str());
+ return 1;
+ }
+ else if ( nCompress > 1 )
{
cmSystemTools::Error("Can only compress a tar file one way; "
"at most one flag of z, j, or J may be used");
@@ -781,7 +810,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if ( flags.find_first_of('c') != flags.npos )
{
if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, compress, verbose, mtime) )
+ outFile.c_str(), files, compress, verbose, mtime, format) )
{
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 8a481d6..6c4a7a6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1260,15 +1260,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
{
- if(create && !SystemTools::FileExists(filename))
+ if (!SystemTools::FileExists(filename))
{
- FILE* file = Fopen(filename, "a+b");
- if(file)
+ if(create)
+ {
+ FILE* file = Fopen(filename, "a+b");
+ if(file)
+ {
+ fclose(file);
+ return true;
+ }
+ return false;
+ }
+ else
{
- fclose(file);
return true;
}
- return false;
}
#if defined(_WIN32) && !defined(__CYGWIN__)
HANDLE h = CreateFileW(