[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-533-gd2d09ae
Stephen Kelly
steveire at gmail.com
Tue Oct 13 18:38:34 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via d2d09aece23f023f3e81586811a31abac0e3292f (commit)
via 2bf7de167f0b72b07c6246679c964d83cdc47d45 (commit)
via 0aa34de5493732d219dd3f58634222677bd19e22 (commit)
via 20b95ef8c83fbcb7705e72c85c9de18ff420562f (commit)
via 841164cb36650574a1a7363c78e4cdf28d5d37fd (commit)
via 2c219bafc045dfdf49529b8ad141fed3dbb4d8e9 (commit)
via 84e0776e77e625ab43c1a5b2031a06a035ae0210 (commit)
via 871ab98dad2ed9d504a081a0ffa62b438793cbe4 (commit)
from e15afa23efdaa409f5f809444fa1ceb98f18210b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2d09aece23f023f3e81586811a31abac0e3292f
commit d2d09aece23f023f3e81586811a31abac0e3292f
Merge: e15afa2 2bf7de1
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 18:38:32 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 13 18:38:32 2015 -0400
Merge topic 'refactor-state-initialization' into next
2bf7de16 Subdirs: Initialize from parent before configuring.
0aa34de5 cmState: Initialize properties immediately.
20b95ef8 cmState: Initialize default definitions immediately.
841164cb cmState: Initialize current directories immediately.
2c219baf cmState: Initialize top level source directories immediately.
84e0776e cmMakefile: Set default internal definitions directly.
871ab98d cmMakefile: Set internal definitions directly.
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bf7de167f0b72b07c6246679c964d83cdc47d45
commit 2bf7de167f0b72b07c6246679c964d83cdc47d45
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Oct 12 19:34:06 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:34:11 2015 +0200
Subdirs: Initialize from parent before configuring.
Add new API for the subdirs command to cmState.
This fixes a regression introduced in commit f716460e (cmMakefile: Move
invokation to initialize snapshot., 2015-10-06).
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3f94125..ce95b2c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1647,6 +1647,7 @@ void cmMakefile::Configure()
std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi)
{
+ (*sdi)->StateSnapshot.InitializeFromParent_ForSubdirsCommand();
this->ConfigureSubDirectory(*sdi);
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 01fd4e2..825204c 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1447,6 +1447,20 @@ std::string cmState::Snapshot::GetProjectName() const
return this->Position->BuildSystemDirectory->ProjectName;
}
+void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand()
+{
+ std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR");
+ std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR");
+ this->InitializeFromParent();
+ this->SetDefinition("CMAKE_SOURCE_DIR",
+ this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR",
+ this->State->GetBinaryDirectory());
+
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir.c_str());
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir.c_str());
+}
+
cmState::Directory::Directory(
cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
const cmState::Snapshot& snapshot)
diff --git a/Source/cmState.h b/Source/cmState.h
index 3e8a465..f2c0c6f 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -90,6 +90,8 @@ public:
void SetProjectName(std::string const& name);
std::string GetProjectName() const;
+ void InitializeFromParent_ForSubdirsCommand();
+
struct StrictWeakOrder
{
bool operator()(const cmState::Snapshot& lhs,
diff --git a/Tests/SubDir/CMakeLists.txt b/Tests/SubDir/CMakeLists.txt
index 6822e6b..32aa93f 100644
--- a/Tests/SubDir/CMakeLists.txt
+++ b/Tests/SubDir/CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 2.6)
project(SUBDIR)
+
subdirs(Executable EXCLUDE_FROM_ALL Examples)
+
+set(DEFINED_AFTER_SUBDIRS_COMMAND 42)
+
write_file(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.")
#WATCOM WMAKE does not support + in the name of a file!
if(WATCOM)
diff --git a/Tests/SubDir/Executable/CMakeLists.txt b/Tests/SubDir/Executable/CMakeLists.txt
index 77e6751..fbe338e 100644
--- a/Tests/SubDir/Executable/CMakeLists.txt
+++ b/Tests/SubDir/Executable/CMakeLists.txt
@@ -1 +1,13 @@
add_executable(test test.cxx)
+
+if (NOT DEFINED_AFTER_SUBDIRS_COMMAND)
+ message(FATAL_ERROR "DEFINED_AFTER_SUBDIRS_COMMAND should be defined.")
+endif()
+
+string(FIND "${CMAKE_CURRENT_BINARY_DIR}" "SubDir/Executable" location)
+string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" dirLength)
+math(EXPR suffixLength "${dirLength} - ${location}")
+
+if (NOT suffixLength EQUAL 17)
+ message(FATAL_ERROR "CMAKE_CURRENT_BINARY_DIR does not end with \"SubDir/Executable\"")
+endif()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0aa34de5493732d219dd3f58634222677bd19e22
commit 0aa34de5493732d219dd3f58634222677bd19e22
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 7 22:34:49 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:21 2015 +0200
cmState: Initialize properties immediately.
Don't leave this as cmMakefile responsibility.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 22d24d7..3f94125 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -55,8 +55,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->SuppressWatches = false;
- // Setup the default include file regular expression (match everything).
- this->SetProperty("INCLUDE_REGULAR_EXPRESSION", "^.*$");
// Setup the default include complaint regular expression (match nothing).
this->ComplainFileRegularExpression = "^$";
// Source and header file extensions that we can handle
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 364b75e..01fd4e2 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1381,6 +1381,10 @@ void cmState::Snapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_FILES_DIRECTORY",
cmake::GetCMakeFilesDirectory());
+
+ // Setup the default include file regular expression (match everything).
+ this->Position->BuildSystemDirectory
+ ->Properties.SetProperty("INCLUDE_REGULAR_EXPRESSION", "^.*$");
}
void cmState::Snapshot::SetDirectoryDefinitions()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20b95ef8c83fbcb7705e72c85c9de18ff420562f
commit 20b95ef8c83fbcb7705e72c85c9de18ff420562f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 21:48:46 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:20 2015 +0200
cmState: Initialize default definitions immediately.
Don't leave this as cmMakefile responsibility.
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 2f69c25..22d4bf0 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -717,6 +717,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index f6447ec..c08897f 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -199,6 +199,7 @@ int main (int argc, char const* const* argv)
cmake cminst;
cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory("");
+ cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
cmsys::auto_ptr<cmMakefile> globalMF(
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index ca5d05a..749a5be 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -736,6 +736,7 @@ void cmCTestLaunch::LoadConfig()
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
std::string fname = this->LogDir;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index b9016af..ee15271 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -314,6 +314,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake = new cmake;
this->CMake->SetHomeDirectory("");
this->CMake->SetHomeOutputDirectory("");
+ this->CMake->GetCurrentSnapshot().SetDefaultDefinitions();
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 968a307..fa3b416 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1590,6 +1590,7 @@ void cmCTestTestHandler::GetListOfTests()
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 67eb042..f3e7121 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -517,6 +517,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 218e702..41df270 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -589,6 +589,7 @@ void cmGlobalUnixMakefileGenerator3
(this->CMakeInstance->GetHomeDirectory());
snapshot.GetDirectory().SetCurrentBinary
(this->CMakeInstance->GetHomeOutputDirectory());
+ snapshot.SetDefaultDefinitions();
mf = new cmMakefile(this, snapshot);
}
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 2023697..b3cf91e 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -67,6 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator ggi(&cm);
cmsys::auto_ptr<cmMakefile> mf(
new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f804d06..22d24d7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -87,8 +87,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->DefineFlags = " ";
- this->AddDefaultDefinitions();
-
this->cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
this->cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)");
@@ -3123,59 +3121,6 @@ void cmMakefile::RemoveVariablesInString(std::string& source,
}
}
-/**
- * Add the default definitions to the makefile. These values must not
- * be dependent on anything that isn't known when this cmMakefile instance
- * is constructed.
- */
-void cmMakefile::AddDefaultDefinitions()
-{
-/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
- With CMake must separate between target and host platform. In most cases
- the tests for WIN32, UNIX and APPLE will be for the target system, so an
- additional set of variables for the host system is required ->
- CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
- WIN32, UNIX and APPLE are now set in the platform files in
- Modules/Platforms/.
- To keep cmake scripts (-P) and custom language and compiler modules
- working, these variables are still also set here in this place, but they
- will be reset in CMakeSystemSpecificInformation.cmake before the platform
- files are executed. */
-#if defined(_WIN32)
- this->StateSnapshot.SetDefinition("WIN32", "1");
- this->StateSnapshot.SetDefinition("CMAKE_HOST_WIN32", "1");
-#else
- this->StateSnapshot.SetDefinition("UNIX", "1");
- this->StateSnapshot.SetDefinition("CMAKE_HOST_UNIX", "1");
-#endif
-#if defined(__CYGWIN__)
- if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32")))
- {
- this->StateSnapshot.SetDefinition("WIN32", "1");
- this->StateSnapshot.SetDefinition("CMAKE_HOST_WIN32", "1");
- }
-#endif
-#if defined(__APPLE__)
- this->StateSnapshot.SetDefinition("APPLE", "1");
- this->StateSnapshot.SetDefinition("CMAKE_HOST_APPLE", "1");
-#endif
-
- char temp[1024];
- sprintf(temp, "%d", cmVersion::GetMinorVersion());
- this->StateSnapshot.SetDefinition("CMAKE_MINOR_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetMajorVersion());
- this->StateSnapshot.SetDefinition("CMAKE_MAJOR_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetPatchVersion());
- this->StateSnapshot.SetDefinition("CMAKE_PATCH_VERSION", temp);
- sprintf(temp, "%d", cmVersion::GetTweakVersion());
- this->StateSnapshot.SetDefinition("CMAKE_TWEAK_VERSION", temp);
- this->StateSnapshot.SetDefinition("CMAKE_VERSION",
- cmVersion::GetCMakeVersion());
-
- this->StateSnapshot.SetDefinition("CMAKE_FILES_DIRECTORY",
- cmake::GetCMakeFilesDirectory());
-}
-
//----------------------------------------------------------------------------
std::string
cmMakefile::GetConfigurations(std::vector<std::string>& configs,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0a8dcd5..96d5849 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -867,7 +867,6 @@ private:
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
- void AddDefaultDefinitions();
typedef std::vector<cmFunctionBlocker*> FunctionBlockersType;
FunctionBlockersType FunctionBlockers;
std::vector<FunctionBlockersType::size_type> FunctionBlockerBarriers;
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 36b1305..fc690f8 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -175,6 +175,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cmake cm;
cm.SetHomeOutputDirectory(targetDirectory);
cm.SetHomeDirectory(targetDirectory);
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index e3f62b5..364b75e 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -12,6 +12,7 @@
#include "cmState.h"
#include "cmake.h"
+#include "cmVersion.h"
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmAlgorithms.h"
@@ -847,6 +848,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
+ snapshot.SetDefaultDefinitions();
snapshot.InitializeFromParent();
snapshot.SetDirectoryDefinitions();
return snapshot;
@@ -1333,6 +1335,54 @@ void InitializeContentFromParent(T& parentContent,
contentEndPosition = thisContent.size();
}
+void cmState::Snapshot::SetDefaultDefinitions()
+{
+ /* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
+ With CMake must separate between target and host platform. In most cases
+ the tests for WIN32, UNIX and APPLE will be for the target system, so an
+ additional set of variables for the host system is required ->
+ CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
+ WIN32, UNIX and APPLE are now set in the platform files in
+ Modules/Platforms/.
+ To keep cmake scripts (-P) and custom language and compiler modules
+ working, these variables are still also set here in this place, but they
+ will be reset in CMakeSystemSpecificInformation.cmake before the platform
+ files are executed. */
+ #if defined(_WIN32)
+ this->SetDefinition("WIN32", "1");
+ this->SetDefinition("CMAKE_HOST_WIN32", "1");
+ #else
+ this->SetDefinition("UNIX", "1");
+ this->SetDefinition("CMAKE_HOST_UNIX", "1");
+ #endif
+ #if defined(__CYGWIN__)
+ if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32")))
+ {
+ this->SetDefinition("WIN32", "1");
+ this->SetDefinition("CMAKE_HOST_WIN32", "1");
+ }
+ #endif
+ #if defined(__APPLE__)
+ this->SetDefinition("APPLE", "1");
+ this->SetDefinition("CMAKE_HOST_APPLE", "1");
+ #endif
+
+ char temp[1024];
+ sprintf(temp, "%d", cmVersion::GetMinorVersion());
+ this->SetDefinition("CMAKE_MINOR_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetMajorVersion());
+ this->SetDefinition("CMAKE_MAJOR_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetPatchVersion());
+ this->SetDefinition("CMAKE_PATCH_VERSION", temp);
+ sprintf(temp, "%d", cmVersion::GetTweakVersion());
+ this->SetDefinition("CMAKE_TWEAK_VERSION", temp);
+ this->SetDefinition("CMAKE_VERSION",
+ cmVersion::GetCMakeVersion());
+
+ this->SetDefinition("CMAKE_FILES_DIRECTORY",
+ cmake::GetCMakeFilesDirectory());
+}
+
void cmState::Snapshot::SetDirectoryDefinitions()
{
this->SetDefinition("CMAKE_SOURCE_DIR",
diff --git a/Source/cmState.h b/Source/cmState.h
index 528da3b..3e8a465 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -97,6 +97,7 @@ public:
};
void SetDirectoryDefinitions();
+ void SetDefaultDefinitions();
private:
friend bool operator==(const cmState::Snapshot& lhs,
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2ecd3d1..7d499de 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -186,6 +186,7 @@ void cmake::CleanupCommandsAndMacros()
{
this->CurrentSnapshot = this->State->Reset();
this->State->RemoveUserDefinedCommands();
+ this->CurrentSnapshot.SetDefaultDefinitions();
}
// Parse the args
@@ -378,6 +379,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
(cmSystemTools::GetCurrentWorkingDirectory());
snapshot.GetDirectory().SetCurrentSource
(cmSystemTools::GetCurrentWorkingDirectory());
+ snapshot.SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
if (this->GetWorkingMode() != NORMAL_MODE)
{
@@ -420,6 +422,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
snapshot.GetDirectory().SetCurrentSource
(cmSystemTools::GetCurrentWorkingDirectory());
// read in the list file to fill the cache
+ snapshot.SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
@@ -1928,6 +1931,7 @@ int cmake::CheckBuildSystem()
cmake cm;
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
@@ -1958,6 +1962,7 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mfd(new cmMakefile(ggd.get(),
cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lgd(
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index ca46111..be492ed 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -765,6 +765,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
startOutDir = cmSystemTools::CollapseFullPath(startOutDir);
cm.SetHomeDirectory(homeDir);
cm.SetHomeOutputDirectory(homeOutDir);
+ cm.GetCurrentSnapshot().SetDefaultDefinitions();
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=841164cb36650574a1a7363c78e4cdf28d5d37fd
commit 841164cb36650574a1a7363c78e4cdf28d5d37fd
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 21:57:54 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:07 2015 +0200
cmState: Initialize current directories immediately.
Don't leave this as cmMakefile responsibility.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2c5501e..f804d06 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -118,32 +118,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->AddSourceGroup("Resources", "\\.plist$");
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
-
- {
- const char* dir = this->StateSnapshot.GetDirectory().GetCurrentSource();
- if (dir)
- {
- this->StateSnapshot.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
- }
- else
- {
- this->StateSnapshot.SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
- this->GetCMakeInstance()->GetHomeDirectory());
- }
- }
- {
- const char* dir = this->StateSnapshot.GetDirectory().GetCurrentBinary();
- if (dir)
- {
- cmSystemTools::MakeDirectory(dir);
- this->StateSnapshot.SetDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
- }
- else
- {
- this->StateSnapshot.SetDefinition("CMAKE_CURRENT_BINARY_DIR",
- this->GetCMakeInstance()->GetHomeOutputDirectory());
- }
- }
}
cmMakefile::~cmMakefile()
@@ -1756,6 +1730,8 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
newSnapshot.GetDirectory().SetCurrentSource(srcPath);
newSnapshot.GetDirectory().SetCurrentBinary(binPath);
+ cmSystemTools::MakeDirectory(binPath.c_str());
+
cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
this->GetGlobalGenerator()->AddMakefile(subMf);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 9de58d8..e3f62b5 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1020,6 +1020,8 @@ void cmState::Directory::SetCurrentSource(std::string const& dir)
loc,
this->DirectoryState->CurrentSourceDirectoryComponents);
this->ComputeRelativePathTopSource();
+
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc.c_str());
}
const char* cmState::Directory::GetCurrentBinary() const
@@ -1038,6 +1040,8 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir)
loc,
this->DirectoryState->CurrentBinaryDirectoryComponents);
this->ComputeRelativePathTopBinary();
+
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str());
}
void cmState::Snapshot::SetListFile(const std::string& listfile)
@@ -1333,8 +1337,12 @@ void cmState::Snapshot::SetDirectoryDefinitions()
{
this->SetDefinition("CMAKE_SOURCE_DIR",
this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->State->GetSourceDirectory());
this->SetDefinition("CMAKE_BINARY_DIR",
this->State->GetBinaryDirectory());
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->State->GetBinaryDirectory());
}
void cmState::Snapshot::InitializeFromParent()
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c219bafc045dfdf49529b8ad141fed3dbb4d8e9
commit 2c219bafc045dfdf49529b8ad141fed3dbb4d8e9
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 21:52:33 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:07 2015 +0200
cmState: Initialize top level source directories immediately.
Don't leave this as cmMakefile responsibility.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eea9d67..2c5501e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -119,10 +119,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
- this->StateSnapshot.SetDefinition("CMAKE_SOURCE_DIR",
- this->GetCMakeInstance()->GetHomeDirectory());
- this->StateSnapshot.SetDefinition("CMAKE_BINARY_DIR",
- this->GetCMakeInstance()->GetHomeOutputDirectory());
{
const char* dir = this->StateSnapshot.GetDirectory().GetCurrentSource();
if (dir)
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 72c7330..9de58d8 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -306,11 +306,21 @@ cmState::Snapshot cmState::Reset()
pos->PolicyScope = this->PolicyStack.Root();
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
+
+ {
+ std::string srcDir =
+ cmDefinitions::Get("CMAKE_SOURCE_DIR", pos->Vars, pos->Root);
+ std::string binDir =
+ cmDefinitions::Get("CMAKE_BINARY_DIR", pos->Vars, pos->Root);
this->VarTree.Clear();
pos->Vars = this->VarTree.Extend(this->VarTree.Root());
pos->Parent = this->VarTree.Root();
pos->Root = this->VarTree.Root();
+ pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir.c_str());
+ pos->Vars->Set("CMAKE_BINARY_DIR", binDir.c_str());
+ }
+
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
"", "", true);
@@ -838,6 +848,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
snapshot.InitializeFromParent();
+ snapshot.SetDirectoryDefinitions();
return snapshot;
}
@@ -1318,6 +1329,14 @@ void InitializeContentFromParent(T& parentContent,
contentEndPosition = thisContent.size();
}
+void cmState::Snapshot::SetDirectoryDefinitions()
+{
+ this->SetDefinition("CMAKE_SOURCE_DIR",
+ this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR",
+ this->State->GetBinaryDirectory());
+}
+
void cmState::Snapshot::InitializeFromParent()
{
PositionType parent = this->Position->DirectoryParent;
diff --git a/Source/cmState.h b/Source/cmState.h
index 2f66f7f..528da3b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -96,6 +96,8 @@ public:
const cmState::Snapshot& rhs) const;
};
+ void SetDirectoryDefinitions();
+
private:
friend bool operator==(const cmState::Snapshot& lhs,
const cmState::Snapshot& rhs);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6846f1b..2ecd3d1 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -980,6 +980,10 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
void cmake::SetHomeDirectory(const std::string& dir)
{
this->State->SetSourceDirectory(dir);
+ if (this->CurrentSnapshot.IsValid())
+ {
+ this->CurrentSnapshot.SetDefinition("CMAKE_SOURCE_DIR", dir);
+ }
}
const char* cmake::GetHomeDirectory() const
@@ -990,6 +994,10 @@ const char* cmake::GetHomeDirectory() const
void cmake::SetHomeOutputDirectory(const std::string& dir)
{
this->State->SetBinaryDirectory(dir);
+ if (this->CurrentSnapshot.IsValid())
+ {
+ this->CurrentSnapshot.SetDefinition("CMAKE_BINARY_DIR", dir);
+ }
}
const char* cmake::GetHomeOutputDirectory() const
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=84e0776e77e625ab43c1a5b2031a06a035ae0210
commit 84e0776e77e625ab43c1a5b2031a06a035ae0210
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 21:45:02 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:06 2015 +0200
cmMakefile: Set default internal definitions directly.
The usage tracking of cmMakefile::AddDefinition is not needed.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a258536..eea9d67 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -50,7 +50,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
{
this->IsSourceFileTryCompile = false;
- // Initialize these first since AddDefaultDefinitions calls AddDefinition
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
@@ -3171,36 +3170,37 @@ void cmMakefile::AddDefaultDefinitions()
will be reset in CMakeSystemSpecificInformation.cmake before the platform
files are executed. */
#if defined(_WIN32)
- this->AddDefinition("WIN32", "1");
- this->AddDefinition("CMAKE_HOST_WIN32", "1");
+ this->StateSnapshot.SetDefinition("WIN32", "1");
+ this->StateSnapshot.SetDefinition("CMAKE_HOST_WIN32", "1");
#else
- this->AddDefinition("UNIX", "1");
- this->AddDefinition("CMAKE_HOST_UNIX", "1");
+ this->StateSnapshot.SetDefinition("UNIX", "1");
+ this->StateSnapshot.SetDefinition("CMAKE_HOST_UNIX", "1");
#endif
#if defined(__CYGWIN__)
if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32")))
{
- this->AddDefinition("WIN32", "1");
- this->AddDefinition("CMAKE_HOST_WIN32", "1");
+ this->StateSnapshot.SetDefinition("WIN32", "1");
+ this->StateSnapshot.SetDefinition("CMAKE_HOST_WIN32", "1");
}
#endif
#if defined(__APPLE__)
- this->AddDefinition("APPLE", "1");
- this->AddDefinition("CMAKE_HOST_APPLE", "1");
+ this->StateSnapshot.SetDefinition("APPLE", "1");
+ this->StateSnapshot.SetDefinition("CMAKE_HOST_APPLE", "1");
#endif
char temp[1024];
sprintf(temp, "%d", cmVersion::GetMinorVersion());
- this->AddDefinition("CMAKE_MINOR_VERSION", temp);
+ this->StateSnapshot.SetDefinition("CMAKE_MINOR_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetMajorVersion());
- this->AddDefinition("CMAKE_MAJOR_VERSION", temp);
+ this->StateSnapshot.SetDefinition("CMAKE_MAJOR_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetPatchVersion());
- this->AddDefinition("CMAKE_PATCH_VERSION", temp);
+ this->StateSnapshot.SetDefinition("CMAKE_PATCH_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetTweakVersion());
- this->AddDefinition("CMAKE_TWEAK_VERSION", temp);
- this->AddDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion());
+ this->StateSnapshot.SetDefinition("CMAKE_TWEAK_VERSION", temp);
+ this->StateSnapshot.SetDefinition("CMAKE_VERSION",
+ cmVersion::GetCMakeVersion());
- this->AddDefinition("CMAKE_FILES_DIRECTORY",
+ this->StateSnapshot.SetDefinition("CMAKE_FILES_DIRECTORY",
cmake::GetCMakeFilesDirectory());
}
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=871ab98dad2ed9d504a081a0ffa62b438793cbe4
commit 871ab98dad2ed9d504a081a0ffa62b438793cbe4
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 13 21:44:14 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 14 00:16:06 2015 +0200
cmMakefile: Set internal definitions directly.
The usage tracking of cmMakefile::AddDefinition is not needed.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 73d3522..a258536 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -120,19 +120,19 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
- this->AddDefinition("CMAKE_SOURCE_DIR",
+ this->StateSnapshot.SetDefinition("CMAKE_SOURCE_DIR",
this->GetCMakeInstance()->GetHomeDirectory());
- this->AddDefinition("CMAKE_BINARY_DIR",
+ this->StateSnapshot.SetDefinition("CMAKE_BINARY_DIR",
this->GetCMakeInstance()->GetHomeOutputDirectory());
{
const char* dir = this->StateSnapshot.GetDirectory().GetCurrentSource();
if (dir)
{
- this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
+ this->StateSnapshot.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
}
else
{
- this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
+ this->StateSnapshot.SetDefinition("CMAKE_CURRENT_SOURCE_DIR",
this->GetCMakeInstance()->GetHomeDirectory());
}
}
@@ -141,11 +141,11 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
if (dir)
{
cmSystemTools::MakeDirectory(dir);
- this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
+ this->StateSnapshot.SetDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
}
else
{
- this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
+ this->StateSnapshot.SetDefinition("CMAKE_CURRENT_BINARY_DIR",
this->GetCMakeInstance()->GetHomeOutputDirectory());
}
}
-----------------------------------------------------------------------
Summary of changes:
Source/CPack/cmCPackGenerator.cxx | 1 +
Source/CPack/cpack.cxx | 1 +
Source/CTest/cmCTestLaunch.cxx | 1 +
Source/CTest/cmCTestScriptHandler.cxx | 1 +
Source/CTest/cmCTestTestHandler.cxx | 1 +
Source/cmCTest.cxx | 1 +
Source/cmGlobalUnixMakefileGenerator3.cxx | 1 +
Source/cmGraphVizWriter.cxx | 1 +
Source/cmMakefile.cxx | 90 +--------------------------
Source/cmMakefile.h | 1 -
Source/cmQtAutoGenerators.cxx | 1 +
Source/cmState.cxx | 95 +++++++++++++++++++++++++++++
Source/cmState.h | 5 ++
Source/cmake.cxx | 13 ++++
Source/cmcmd.cxx | 1 +
Tests/SubDir/CMakeLists.txt | 4 ++
Tests/SubDir/Executable/CMakeLists.txt | 12 ++++
17 files changed, 142 insertions(+), 88 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list