Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
36a85b4c
Commit
36a85b4c
authored
Mar 19, 2012
by
Brad King
Committed by
Kitware Robot
Mar 19, 2012
Browse files
Merge topic 'write-cache-atomically'
9eb8e4b2
Write CMakeCache.txt atomically (
#13040
)
parents
bfc8d137
9eb8e4b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/cmCacheManager.cxx
View file @
36a85b4c
...
...
@@ -13,6 +13,7 @@
#include
"cmCacheManager.h"
#include
"cmSystemTools.h"
#include
"cmCacheManager.h"
#include
"cmGeneratedFileStream.h"
#include
"cmMakefile.h"
#include
"cmake.h"
#include
"cmVersion.h"
...
...
@@ -431,9 +432,8 @@ bool cmCacheManager::SaveCache(const char* path)
{
std
::
string
cacheFile
=
path
;
cacheFile
+=
"/CMakeCache.txt"
;
std
::
string
tempFile
=
cacheFile
;
tempFile
+=
".tmp"
;
std
::
ofstream
fout
(
tempFile
.
c_str
());
cmGeneratedFileStream
fout
(
cacheFile
.
c_str
());
fout
.
SetCopyIfDifferent
(
true
);
if
(
!
fout
)
{
cmSystemTools
::
Error
(
"Unable to open cache file for save. "
,
...
...
@@ -561,10 +561,7 @@ bool cmCacheManager::SaveCache(const char* path)
}
}
fout
<<
"
\n
"
;
fout
.
close
();
cmSystemTools
::
CopyFileIfDifferent
(
tempFile
.
c_str
(),
cacheFile
.
c_str
());
cmSystemTools
::
RemoveFile
(
tempFile
.
c_str
());
fout
.
Close
();
std
::
string
checkCacheFile
=
path
;
checkCacheFile
+=
cmake
::
GetCMakeFilesDirectory
();
cmSystemTools
::
MakeDirectory
(
checkCacheFile
.
c_str
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment