On 11/14/2014 12:31 PM, Ruslan Baratov wrote: > ConvertToWindowsExtendedPath fix + tests
Thanks. I started testing on Linux so far. A few more comments: - Please add more test cases covering all the file(LOCK) argument processing error messages. - Please squash in the attached patch to your commit that adds the file(LOCK) command to CMake. We should not need to build it during bootstrap. - Instead of ::sleep you can use cmSystemTools::Delay() - We need to test whether failing to lock after a timeout actually works. I tried adding a line to Tests/RunCMake/file/LOCK.cmake: file(LOCK "${lfile}" TIMEOUT 3) at the end of the file, duplicating the one before it. I expected to see a 3 second delay followed by a lock failure. Instead it fails immediately. Is that expected? Thanks, -Brad
>From 36c0d3450f3968c2f3a3ee8912c6b9a12978906e Mon Sep 17 00:00:00 2001 Message-Id: <36c0d3450f3968c2f3a3ee8912c6b9a12978906e.1415994879.git.brad.k...@kitware.com> From: Brad King <brad.k...@kitware.com> Date: Fri, 14 Nov 2014 14:39:46 -0500 Subject: [PATCH] file(LOCK): Drop this API during CMake bootstrap build CMake's own build system won't need this. --- Source/cmFileCommand.cxx | 9 +++++++-- Source/cmGlobalGenerator.h | 6 +++++- Source/cmLocalGenerator.cxx | 4 ++++ Source/cmMakefile.cxx | 4 ++++ bootstrap | 3 --- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 7d5d4c7..e060bbd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -21,9 +21,8 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cm_curl.h" -#endif - #include "cmFileLockResult.h" +#endif #undef GetCurrentDirectory #include <assert.h> @@ -3511,6 +3510,7 @@ bool cmFileCommand::HandleGenerateCommand( bool cmFileCommand::HandleLockCommand( std::vector<std::string> const& args) { +#if defined(CMAKE_BUILD_WITH_CMAKE) // Default values bool directory = false; bool release = false; @@ -3691,6 +3691,11 @@ bool cmFileCommand::HandleLockCommand( } return true; +#else + static_cast<void>(args); + this->SetError("sub-command LOCK not implemented in boostrap cmake"); + return false; +#endif } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0f79174..0847654 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -21,9 +21,9 @@ #include "cmExportSetMap.h" // For cmExportSetMap #include "cmGeneratorTarget.h" #include "cmGeneratorExpression.h" -#include "cmFileLockPool.h" #if defined(CMAKE_BUILD_WITH_CMAKE) +# include "cmFileLockPool.h" # include <cmsys/hash_map.hxx> #endif @@ -349,7 +349,9 @@ public: std::set<cmTarget const*> const& GetFilenameTargetDepends(cmSourceFile* sf) const; +#if defined(CMAKE_BUILD_WITH_CMAKE) cmFileLockPool& GetFileLockPool() { return FileLockPool; } +#endif protected: virtual void Generate(); @@ -502,8 +504,10 @@ private: mutable std::map<cmSourceFile*, std::set<cmTarget const*> > FilenameTargetDepends; +#if defined(CMAKE_BUILD_WITH_CMAKE) // Pool of file locks cmFileLockPool FileLockPool; +#endif }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6b5d785..2de6c93 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -79,11 +79,15 @@ public: this->GG = lg->GetGlobalGenerator(); this->LG = this->GG->GetCurrentLocalGenerator(); this->GG->SetCurrentLocalGenerator(lg); +#if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); +#endif } ~cmLocalGeneratorCurrent() { +#if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); +#endif this->GG->SetCurrentLocalGenerator(this->LG); } }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a94c752..5484421 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4426,8 +4426,10 @@ void cmMakefile::PushScope() this->Internal->VarStack.push(cmDefinitions(parent)); this->Internal->VarInitStack.push(init); this->Internal->VarUsageStack.push(usage); +#if defined(CMAKE_BUILD_WITH_CMAKE) this->GetLocalGenerator()->GetGlobalGenerator()-> GetFileLockPool().PushFunctionScope(); +#endif } void cmMakefile::PopScope() @@ -4465,8 +4467,10 @@ void cmMakefile::PopScope() { this->Internal->VarUsageStack.top().insert(*it); } +#if defined(CMAKE_BUILD_WITH_CMAKE) this->GetLocalGenerator()->GetGlobalGenerator()-> GetFileLockPool().PopFunctionScope(); +#endif } void cmMakefile::RaiseScope(const std::string& var, const char *varDef) diff --git a/bootstrap b/bootstrap index 19189d3..94bed0e 100755 --- a/bootstrap +++ b/bootstrap @@ -286,9 +286,6 @@ CMAKE_CXX_SOURCES="\ cmSystemTools \ cmTestGenerator \ cmVersion \ - cmFileLock \ - cmFileLockPool \ - cmFileLockResult \ cmFileTimeComparison \ cmGlobalUnixMakefileGenerator3 \ cmLocalUnixMakefileGenerator3 \ -- 2.1.1
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers